1## Makefile for the C++03 sources of the GNU C++ Standard library.
2##
3## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4## 2006, 2007, 2008, 2009, 2010, 2011, 2012
5## Free Software Foundation, Inc.
6##
7## This file is part of the libstdc++ version 3 distribution.
8## Process this file with automake to produce Makefile.in.
9
10## This file is part of the GNU ISO C++ Library.  This library is free
11## software; you can redistribute it and/or modify it under the
12## terms of the GNU General Public License as published by the
13## Free Software Foundation; either version 3, or (at your option)
14## any later version.
15
16## This library is distributed in the hope that it will be useful,
17## but WITHOUT ANY WARRANTY; without even the implied warranty of
18## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19## GNU General Public License for more details.
20
21## You should have received a copy of the GNU General Public License along
22## with this library; see the file COPYING3.  If not see
23## <http://www.gnu.org/licenses/>.
24
25include $(top_srcdir)/fragment.am
26
27# Convenience library for C++98 runtime.
28noinst_LTLIBRARIES = libc++98convenience.la
29
30headers =
31
32# Source files linked in via configuration/make substitution for a
33# particular host.
34host_sources = \
35	atomicity.cc \
36	codecvt_members.cc \
37	collate_members.cc \
38	ctype_configure_char.cc \
39	ctype_members.cc \
40	messages_members.cc \
41	monetary_members.cc \
42	numeric_members.cc \
43	time_members.cc
44
45codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
46	$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
47
48collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
49	$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
50
51ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc
52	$(LN_S) ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc . || true
53
54ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
55	$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
56
57messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
58	$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
59
60monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
61	$(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
62
63numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
64	$(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
65
66time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
67	$(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
68
69atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
70atomicity.cc: ${atomicity_file}
71	$(LN_S) ${atomicity_file} ./atomicity.cc || true
72
73# Source files linked in via configuration/make substitution for a
74# particular host, but with ad hoc naming rules.
75host_sources_extra = \
76	basic_file.cc c++locale.cc \
77	${inst_sources} ${parallel_sources}
78
79c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
80	$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
81
82basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
83	$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
84
85if ENABLE_PARALLEL
86parallel_sources = parallel_settings.cc
87else
88parallel_sources =
89endif
90
91if ENABLE_EXTERN_TEMPLATE
92XTEMPLATE_FLAGS = -fno-implicit-templates
93inst_sources = \
94	allocator-inst.cc \
95	concept-inst.cc \
96	ext-inst.cc \
97	ios-inst.cc \
98	iostream-inst.cc \
99	istream-inst.cc \
100	locale-inst.cc \
101	misc-inst.cc \
102	ostream-inst.cc \
103	sstream-inst.cc \
104	streambuf-inst.cc \
105	wlocale-inst.cc
106else
107XTEMPLATE_FLAGS =
108inst_sources =
109endif
110
111# Sources present in the src directory, always present.
112sources = \
113	bitmap_allocator.cc \
114	pool_allocator.cc \
115	mt_allocator.cc \
116	codecvt.cc \
117	complex_io.cc \
118	ctype.cc \
119	globals_io.cc \
120	hash_tr1.cc \
121	hashtable_tr1.cc \
122	ios.cc \
123	ios_failure.cc \
124	ios_init.cc \
125	ios_locale.cc \
126	list.cc \
127	locale.cc \
128	locale_init.cc \
129	locale_facets.cc \
130	localename.cc \
131	math_stubs_float.cc \
132	math_stubs_long_double.cc \
133	stdexcept.cc \
134	strstream.cc \
135	tree.cc \
136	istream.cc \
137	streambuf.cc \
138	valarray.cc \
139	${host_sources} \
140	${host_sources_extra}
141
142vpath % $(top_srcdir)/src/c++98
143
144libc__98convenience_la_SOURCES = $(sources)
145
146# Use special rules for the deprecated source files so that they find
147# deprecated include files.
148GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
149strstream.lo: strstream.cc
150	$(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
151strstream.o: strstream.cc
152	$(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
153
154# Use special rules for the concept-checking instantiations so that all
155# the generated template functions are also instantiated.  Force the checks
156# to be on so that the instantiations are actually seen.
157concept-inst.lo: concept-inst.cc
158	$(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
159concept-inst.o: concept-inst.cc
160	$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
161
162# Use special rules for parallel mode compilation.
163PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
164parallel_settings.lo: parallel_settings.cc
165	$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $<
166parallel_settings.o: parallel_settings.cc
167	$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
168
169# AM_CXXFLAGS needs to be in each subdirectory so that it can be
170# modified in a per-library or per-sub-library way.  Need to manually
171# set this option because CONFIG_CXXFLAGS has to be after
172# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
173# as the occasion calls for it.
174AM_CXXFLAGS = \
175	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
176	$(XTEMPLATE_FLAGS) \
177	$(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
178
179AM_MAKEFLAGS = \
180	"gxx_include_dir=$(gxx_include_dir)"
181
182# Libtool notes
183
184# 1) In general, libtool expects an argument such as `--tag=CXX' when
185# using the C++ compiler, because that will enable the settings
186# detected when C++ support was being configured.  However, when no
187# such flag is given in the command line, libtool attempts to figure
188# it out by matching the compiler name in each configuration section
189# against a prefix of the command line.  The problem is that, if the
190# compiler name and its initial flags stored in the libtool
191# configuration file don't match those in the command line, libtool
192# can't decide which configuration to use, and it gives up.  The
193# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
194# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
195# attempt to infer which configuration to use.
196#
197# The second tag argument, `--tag disable-shared` means that libtool
198# only compiles each source once, for static objects. In actuality,
199# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
200# the libtool command that is used create the object, which is
201# suitable for shared libraries.  The `--tag disable-shared` must be
202# placed after --tag CXX lest things CXX undo the affect of
203# disable-shared.
204
205# 2) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
206# last. (That way, things like -O2 passed down from the toplevel can
207# be overridden by --enable-debug.)
208LTCXXCOMPILE = \
209	$(LIBTOOL) --tag CXX --tag disable-shared \
210	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
211	--mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
212	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
213
214LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
215
216# 3) We'd have a problem when building the shared libstdc++ object if
217# the rules automake generates would be used.  We cannot allow g++ to
218# be used since this would add -lstdc++ to the link line which of
219# course is problematic at this point.  So, we get the top-level
220# directory to configure libstdc++-v3 to use gcc as the C++
221# compilation driver.
222CXXLINK = \
223	$(LIBTOOL) --tag CXX --tag disable-shared \
224	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
225	--mode=link $(CXX) \
226	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
227