1## Makefile for the src subdirectory 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
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# Cross compiler support.
28toolexeclib_LTLIBRARIES = libstdc++.la
29
30# Symbol versioning for shared libraries.
31if ENABLE_SYMVERS
32libstdc++-symbols.ver:  ${glibcxx_srcdir}/$(SYMVER_FILE) \
33		$(port_specific_symbol_files)
34	cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver
35	chmod +w ./libstdc++-symbols.ver
36	if test "x$(port_specific_symbol_files)" != x; then \
37	  if grep '^# Appended to version file.' \
38	       $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
39	    cat $(port_specific_symbol_files) >> $@; \
40	  else \
41	    sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
42	    sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
43	    cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
44	    rm tmp.top tmp.bottom; \
45	  fi; \
46	fi
47
48if ENABLE_SYMVERS_GNU
49version_arg = -Wl,--version-script=libstdc++-symbols.ver
50version_dep = libstdc++-symbols.ver
51endif
52if ENABLE_SYMVERS_GNU_NAMESPACE
53version_arg = -Wl,--version-script=libstdc++-symbols.ver
54version_dep = libstdc++-symbols.ver
55endif
56if ENABLE_SYMVERS_DARWIN
57version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist
58version_dep = libstdc++-symbols.explist
59libstdc++-symbols.explist : libstdc++-symbols.ver \
60		${glibcxx_srcdir}/scripts/make_exports.pl \
61		$(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
62	perl ${glibcxx_srcdir}/scripts/make_exports.pl \
63	  libstdc++-symbols.ver \
64	  $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
65	 `echo $(libstdc___la_LIBADD) | \
66	    sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
67	 > $@ || (rm -f $@ ; exit 1)
68endif
69else
70version_arg =
71version_dep =
72endif
73
74
75# Source files linked in via configuration/make substitution for a
76# particular host.
77host_sources = \
78	atomicity.cc \
79	codecvt_members.cc \
80	collate_members.cc \
81	ctype_members.cc \
82	messages_members.cc \
83	monetary_members.cc \
84	numeric_members.cc \
85	time_members.cc 
86
87codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
88	$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
89
90collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
91	$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
92
93ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
94	$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
95
96messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
97	$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
98
99monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
100	$(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
101
102numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
103	$(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
104
105time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
106	$(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
107
108atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
109atomicity.cc: ${atomicity_file}
110	$(LN_S) ${atomicity_file} ./atomicity.cc || true
111
112# Source files linked in via configuration/make substitution for a
113# particular host, but with ad hoc naming rules.
114host_sources_extra = \
115	basic_file.cc c++locale.cc ${ldbl_compat_sources} ${parallel_sources}
116
117c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
118	$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
119
120basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
121	$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
122
123if ENABLE_PARALLEL
124parallel_sources = parallel_list.cc parallel_settings.cc \
125	           compatibility-parallel_list.cc
126else
127parallel_sources =
128endif
129
130if GLIBCXX_LDBL_COMPAT
131ldbl_compat_sources = compatibility-ldbl.cc
132else
133ldbl_compat_sources =
134endif
135
136# Sources present in the src directory.
137sources = \
138	atomic.cc \
139	bitmap_allocator.cc \
140	pool_allocator.cc \
141	mt_allocator.cc \
142	codecvt.cc \
143	compatibility.cc \
144	compatibility-c++0x.cc \
145	compatibility-debug_list.cc \
146	compatibility-list.cc \
147	complex_io.cc \
148	ctype.cc \
149	debug.cc \
150	functexcept.cc \
151	globals_io.cc \
152	hash_c++0x.cc \
153	hash_tr1.cc \
154	hashtable_c++0x.cc \
155	hashtable_tr1.cc \
156	ios.cc \
157	ios_failure.cc \
158	ios_init.cc \
159	ios_locale.cc \
160	limits.cc \
161	list.cc \
162	debug_list.cc \
163	locale.cc \
164	locale_init.cc \
165	locale_facets.cc \
166	localename.cc \
167	math_stubs_float.cc \
168	math_stubs_long_double.cc \
169	stdexcept.cc \
170	strstream.cc \
171	system_error.cc \
172	tree.cc \
173	allocator-inst.cc \
174	concept-inst.cc \
175	fstream-inst.cc \
176	ext-inst.cc \
177	ios-inst.cc \
178	iostream-inst.cc \
179	istream-inst.cc \
180	istream.cc \
181	locale-inst.cc \
182	misc-inst.cc \
183	ostream-inst.cc \
184	sstream-inst.cc \
185	streambuf-inst.cc \
186	streambuf.cc \
187	string-inst.cc \
188	valarray-inst.cc \
189	wlocale-inst.cc \
190	wstring-inst.cc \
191	mutex.cc \
192	condition_variable.cc \
193	chrono.cc \
194	thread.cc \
195	future.cc \
196	${host_sources} \
197	${host_sources_extra} 
198
199vpath % $(top_srcdir)/src
200vpath % $(top_srcdir)
201
202libstdc___la_SOURCES = $(sources)
203
204libstdc___la_LIBADD = \
205	$(GLIBCXX_LIBS) \
206	$(top_builddir)/libsupc++/libsupc++convenience.la
207
208libstdc___la_DEPENDENCIES = \
209	${version_dep} \
210	$(top_builddir)/libsupc++/libsupc++convenience.la
211
212libstdc___la_LDFLAGS = \
213	-version-info $(libtool_VERSION) ${version_arg} -lm 
214
215libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS)
216
217# Use special rules for the deprecated source files so that they find
218# deprecated include files.
219GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
220strstream.lo: strstream.cc
221	$(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
222strstream.o: strstream.cc
223	$(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
224
225# Use special rules for the concept-checking instantiations so that all
226# the generated template functions are also instantiated.  Force the checks
227# to be on so that the instantiations are actually seen.
228concept-inst.lo: concept-inst.cc
229	$(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
230concept-inst.o: concept-inst.cc
231	$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
232
233# Use special rules for parallel mode compilation.
234PARALLEL_FLAGS = -fopenmp -D_GLIBCXX_PARALLEL -I$(glibcxx_builddir)/../libgomp
235parallel_list.lo: parallel_list.cc
236	$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $<
237parallel_list.o: parallel_list.cc
238	$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
239
240parallel_settings.lo: parallel_settings.cc
241	$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $<
242parallel_settings.o: parallel_settings.cc
243	$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
244
245compatibility-parallel_list.lo: compatibility-parallel_list.cc
246	$(LTCXXCOMPILE) $(PARALLEL_FLAGS) -c $<
247compatibility-parallel_list.o: compatibility-parallel_list.cc
248	$(CXXCOMPILE) $(PARALLEL_FLAGS) -c $<
249
250# Use special rules for the C++0x sources so that the proper flags are passed.
251functexcept.lo: functexcept.cc
252	$(LTCXXCOMPILE) -std=gnu++0x -c $<
253functexcept.o: functexcept.cc
254	$(CXXCOMPILE) -std=gnu++0x -c $<
255
256system_error.lo: system_error.cc
257	$(LTCXXCOMPILE) -std=gnu++0x -c $<
258system_error.o: system_error.cc
259	$(CXXCOMPILE) -std=gnu++0x -c $<
260
261mutex.lo: mutex.cc
262	$(LTCXXCOMPILE) -std=gnu++0x -c $<
263mutex.o: mutex.cc
264	$(CXXCOMPILE) -std=gnu++0x -c $<
265
266condition_variable.lo: condition_variable.cc
267	$(LTCXXCOMPILE) -std=gnu++0x -c $<
268condition_variable.o: condition_variable.cc
269	$(CXXCOMPILE) -std=gnu++0x -c $<
270
271compatibility-c++0x.lo: compatibility-c++0x.cc
272	$(LTCXXCOMPILE) -std=gnu++0x -c $<
273compatibility-c++0x.o: compatibility-c++0x.cc
274	$(CXXCOMPILE) -std=gnu++0x -c $<
275
276hash_c++0x.lo: hash_c++0x.cc
277	$(LTCXXCOMPILE) -std=gnu++0x -c $<
278hash_c++0x.o: hash_c++0x.cc
279	$(CXXCOMPILE) -std=gnu++0x -c $<
280
281hashtable_c++0x.lo: hashtable_c++0x.cc
282	$(LTCXXCOMPILE) -std=gnu++0x -c $<
283hashtable_c++0x.o: hashtable_c++0x.cc
284	$(CXXCOMPILE) -std=gnu++0x -c $<
285
286limits.lo: limits.cc
287	$(LTCXXCOMPILE) -std=gnu++0x -c $<
288limits.o: limits.cc
289	$(CXXCOMPILE) -std=gnu++0x -c $<
290
291atomic.lo: atomic.cc
292	$(LTCXXCOMPILE) -std=gnu++0x -c $<
293atomic.o: atomic.cc
294	$(CXXCOMPILE) -std=gnu++0x -c $<
295
296fstream-inst.lo: fstream-inst.cc
297	$(LTCXXCOMPILE) -std=gnu++0x -c $<
298fstream-inst.o: fstream-inst.cc
299	$(CXXCOMPILE) -std=gnu++0x -c $<
300
301string-inst.lo: string-inst.cc
302	$(LTCXXCOMPILE) -std=gnu++0x -c $<
303string-inst.o: string-inst.cc
304	$(CXXCOMPILE) -std=gnu++0x -c $<
305
306wstring-inst.lo: wstring-inst.cc
307	$(LTCXXCOMPILE) -std=gnu++0x -c $<
308wstring-inst.o: wstring-inst.cc
309	$(CXXCOMPILE) -std=gnu++0x -c $<
310
311chrono.lo: chrono.cc
312	$(LTCXXCOMPILE) -std=gnu++0x -c $<
313chrono.o: chrono.cc
314	$(CXXCOMPILE) -std=gnu++0x -c $<
315
316thread.lo: thread.cc
317	$(LTCXXCOMPILE) -std=gnu++0x -c $<
318thread.o: thread.cc
319	$(CXXCOMPILE) -std=gnu++0x -c $<
320
321future.lo: future.cc
322	$(LTCXXCOMPILE) -std=gnu++0x -c $<
323future.o: future.cc
324	$(CXXCOMPILE) -std=gnu++0x -c $<
325
326if GLIBCXX_LDBL_COMPAT
327# Use special rules for compatibility-ldbl.cc compilation, as we need to
328# pass -mlong-double-64.
329compatibility-ldbl.lo: compatibility-ldbl.cc
330	$(LTCXXCOMPILE) -mlong-double-64 -c $<
331compatibility-ldbl.o: compatibility-ldbl.cc
332	$(CXXCOMPILE) -mlong-double-64 -c $<
333endif
334
335# AM_CXXFLAGS needs to be in each subdirectory so that it can be
336# modified in a per-library or per-sub-library way.  Need to manually
337# set this option because CONFIG_CXXFLAGS has to be after
338# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
339# as the occasion calls for it.
340AM_CXXFLAGS = \
341	-fno-implicit-templates \
342	$(WARN_CXXFLAGS) \
343	$(OPTIMIZE_CXXFLAGS) \
344	$(CONFIG_CXXFLAGS)
345
346
347# libstdc++ libtool notes
348
349# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
350# last. (That way, things like -O2 passed down from the toplevel can
351# be overridden by --enable-debug.)
352
353# 2) In general, libtool expects an argument such as `--tag=CXX' when
354# using the C++ compiler, because that will enable the settings
355# detected when C++ support was being configured.  However, when no
356# such flag is given in the command line, libtool attempts to figure
357# it out by matching the compiler name in each configuration section
358# against a prefix of the command line.  The problem is that, if the
359# compiler name and its initial flags stored in the libtool
360# configuration file don't match those in the command line, libtool
361# can't decide which configuration to use, and it gives up.  The
362# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
363# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
364# attempt to infer which configuration to use
365LTCXXCOMPILE = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile \
366	       $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
367
368LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
369
370# 3) We'd have a problem when building the shared libstdc++ object if
371# the rules automake generates would be used.  We cannot allow g++ to
372# be used since this would add -lstdc++ to the link line which of
373# course is problematic at this point.  So, we get the top-level
374# directory to configure libstdc++-v3 to use gcc as the C++
375# compilation driver.
376CXXLINK = $(LIBTOOL) --tag CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
377	  $(CXX) $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
378
379
380# Added bits to build debug library.
381if GLIBCXX_BUILD_DEBUG
382all-local: build_debug
383install-data-local: install_debug
384else
385all-local:
386install-data-local:
387endif
388
389debugdir = debug
390
391# Build a set of debug objects here.
392# Take care to fix all possibly-relative paths.
393stamp-debug:
394	if test ! -d ${debugdir}; then \
395	  mkdir -p ${debugdir}; \
396	  (cd ${debugdir}; \
397	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
398	      -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \
399	      -e 's/srcdir = \.\./srcdir = ..\/../' \
400	      -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
401	      -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \
402	      -e 's/all-local: build_debug/all-local:/' \
403	      -e 's/install-data-local: install_debug/install-data-local:/' \
404	  < ../Makefile > Makefile) ; \
405	fi; \
406	echo `date` > stamp-debug;
407
408build_debug: stamp-debug
409	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
410
411# Install debug library here.
412install_debug:
413	(cd ${debugdir} && $(MAKE) \
414	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
415