197403Sobrien## Makefile for the src subdirectory of the GNU C++ Standard library.
297403Sobrien##
3169691Skan## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
497403Sobrien## Free Software Foundation, Inc.
597403Sobrien##
697403Sobrien## This file is part of the libstdc++ version 3 distribution.
797403Sobrien## Process this file with automake to produce Makefile.in.
897403Sobrien
997403Sobrien## This file is part of the GNU ISO C++ Library.  This library is free
1097403Sobrien## software; you can redistribute it and/or modify it under the
1197403Sobrien## terms of the GNU General Public License as published by the
1297403Sobrien## Free Software Foundation; either version 2, or (at your option)
1397403Sobrien## any later version.
1497403Sobrien
1597403Sobrien## This library is distributed in the hope that it will be useful,
1697403Sobrien## but WITHOUT ANY WARRANTY; without even the implied warranty of
1797403Sobrien## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1897403Sobrien## GNU General Public License for more details.
1997403Sobrien
2097403Sobrien## You should have received a copy of the GNU General Public License along
2197403Sobrien## with this library; see the file COPYING.  If not, write to the Free
22169691Skan## Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
2397403Sobrien## USA.
2497403Sobrien
25132720Skaninclude $(top_srcdir)/fragment.am
2697403Sobrien
27103447Skan# Cross compiler support.
2897403Sobrientoolexeclib_LTLIBRARIES = libstdc++.la
2997403Sobrien
30117397Skan# Symbol versioning for shared libraries.
31169691Skanif ENABLE_SYMVERS
32169691Skanlibstdc++-symbols.ver:  ${glibcxx_srcdir}/$(SYMVER_FILE) \
33169691Skan		$(port_specific_symbol_files)
34169691Skan	cp ${glibcxx_srcdir}/$(SYMVER_FILE) ./libstdc++-symbols.ver
35132720Skan	if test "x$(port_specific_symbol_files)" != x; then \
36169691Skan	  if grep '^# Appended to version file.' \
37169691Skan	       $(port_specific_symbol_files) /dev/null > /dev/null 2>&1; then \
38169691Skan	    cat $(port_specific_symbol_files) >> $@; \
39169691Skan	  else \
40169691Skan	    sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
41169691Skan	    sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
42169691Skan	    cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
43169691Skan	    rm tmp.top tmp.bottom; \
44169691Skan	  fi; \
45132720Skan	fi
46169691Skan
47169691Skanif ENABLE_SYMVERS_GNU
48169691Skanversion_arg = -Wl,--version-script=libstdc++-symbols.ver
49169691Skanversion_dep = libstdc++-symbols.ver
50169691Skanendif
51169691Skanif ENABLE_SYMVERS_GNU_NAMESPACE
52169691Skanversion_arg = -Wl,--version-script=libstdc++-symbols.ver
53169691Skanversion_dep = libstdc++-symbols.ver
54169691Skanendif
55169691Skanif ENABLE_SYMVERS_DARWIN
56169691Skanversion_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist
57169691Skanversion_dep = libstdc++-symbols.explist
58169691Skanlibstdc++-symbols.explist : libstdc++-symbols.ver \
59169691Skan		${glibcxx_srcdir}/scripts/make_exports.pl \
60169691Skan		$(libstdc___la_OBJECTS) $(libstdc___la_LIBADD)
61169691Skan	perl ${glibcxx_srcdir}/scripts/make_exports.pl \
62169691Skan	  libstdc++-symbols.ver \
63169691Skan	  $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \
64169691Skan	 `echo $(libstdc___la_LIBADD) | \
65169691Skan	    sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \
66169691Skan	 > $@ || (rm -f $@ ; exit 1)
67169691Skanendif
68117397Skanelse
69117397Skanversion_arg =
70132720Skanversion_dep =
71117397Skanendif
72117397Skan
7397403Sobrien
74117397Skan# Source files linked in via configuration/make substitution for a
75132720Skan# particular host.
76132720Skanhost_sources = \
77132720Skan	atomicity.cc \
78103447Skan	codecvt_members.cc \
79103447Skan	collate_members.cc \
80103447Skan	ctype_members.cc \
81103447Skan	messages_members.cc \
82103447Skan	monetary_members.cc \
83103447Skan	numeric_members.cc \
84132720Skan	time_members.cc 
85103447Skan
86132720Skancodecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
87132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
88117397Skan
89132720Skancollate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
90132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
91117397Skan
92132720Skanctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
93132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
94117397Skan
95132720Skanmessages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
96132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
97117397Skan
98132720Skanmonetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
99132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
100117397Skan
101132720Skannumeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
102132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
103117397Skan
104132720Skantime_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
105132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
106117397Skan
107132720Skanatomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
108132720Skanatomicity.cc: ${atomicity_file}
109132720Skan	$(LN_S) ${atomicity_file} ./atomicity.cc || true
110132720Skan
111117397Skan# Source files linked in via configuration/make substitution for a
112132720Skan# particular host, but with ad hoc naming rules.
113132720Skanhost_sources_extra = \
114103447Skan	basic_file.cc \
115132720Skan	c++locale.cc
116103447Skan
117132720Skanc++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
118132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
119117397Skan
120132720Skanbasic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
121132720Skan	$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
122117397Skan
123169691Skanif GLIBCXX_LDBL_COMPAT
124169691Skanldbl_compat_sources = compatibility-ldbl.cc
125169691Skanelse
126169691Skanldbl_compat_sources =
127169691Skanendif
128169691Skan
129103447Skan# Sources present in the src directory.
13097403Sobriensources = \
131169691Skan	bitmap_allocator.cc \
132169691Skan	pool_allocator.cc \
133169691Skan	mt_allocator.cc \
134103447Skan	codecvt.cc \
135169691Skan	compatibility.cc \
136103447Skan	complex_io.cc \
137103447Skan	ctype.cc \
138132720Skan	debug.cc \
139132720Skan	debug_list.cc \
140103447Skan	functexcept.cc \
141132720Skan	globals_io.cc \
142103447Skan	ios.cc \
143132720Skan	ios_failure.cc \
144132720Skan	ios_init.cc \
145132720Skan	ios_locale.cc \
146103447Skan	limits.cc \
147132720Skan	list.cc \
148103447Skan	locale.cc \
149132720Skan	locale_init.cc \
150132720Skan	locale_facets.cc \
151132720Skan	localename.cc \
152132720Skan	stdexcept.cc \
153132720Skan	strstream.cc \
154132720Skan	tree.cc \
155132720Skan	allocator-inst.cc \
156132720Skan	concept-inst.cc \
157132720Skan	fstream-inst.cc \
158132720Skan	ext-inst.cc \
159169691Skan	ios-inst.cc \
160169691Skan	iostream-inst.cc \
161132720Skan	istream-inst.cc \
162169691Skan	istream.cc \
163103447Skan	locale-inst.cc \
164103447Skan	misc-inst.cc \
165103447Skan	ostream-inst.cc \
166103447Skan	sstream-inst.cc \
167103447Skan	streambuf-inst.cc \
168169691Skan	streambuf.cc \
169103447Skan	string-inst.cc \
170103447Skan	valarray-inst.cc \
171132720Skan	wlocale-inst.cc \
172103447Skan	wstring-inst.cc \
173132720Skan	${host_sources} \
174169691Skan	${host_sources_extra} \
175169691Skan	${ldbl_compat_sources}
17697403Sobrien
17797403SobrienVPATH = $(top_srcdir)/src:$(top_srcdir)
17897403Sobrien
17997403Sobrienlibstdc___la_SOURCES = $(sources)
18097403Sobrien
18197403Sobrienlibstdc___la_LIBADD = \
182132720Skan	$(top_builddir)/libmath/libmath.la \
183117397Skan	$(top_builddir)/libsupc++/libsupc++convenience.la
18497403Sobrien
185132720Skanlibstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
18697403Sobrien
18797403Sobrienlibstdc___la_LDFLAGS = \
188132720Skan	-version-info $(libtool_VERSION) ${version_arg} -lm 
18997403Sobrien
19097403Sobrien# Use special rules for the deprecated source files so that they find
19197403Sobrien# deprecated include files.
192132720SkanGLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
19397403Sobrienstrstream.lo: strstream.cc
194132720Skan	$(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
19597403Sobrienstrstream.o: strstream.cc
196132720Skan	$(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
19797403Sobrien
19897403Sobrien# Use special rules for the concept-checking instantiations so that all
19997403Sobrien# the generated template functions are also instantiated.  Force the checks
20097403Sobrien# to be on so that the instantiations are actually seen.
20197403Sobrienconcept-inst.lo: concept-inst.cc
202132720Skan	$(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
20397403Sobrienconcept-inst.o: concept-inst.cc
204132720Skan	$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
20597403Sobrien
206169691Skanif GLIBCXX_LDBL_COMPAT
207169691Skan# Use special rules for compatibility-ldbl.cc compilation, as we need to
208169691Skan# pass -mlong-double-64.
209169691Skancompatibility-ldbl.lo: compatibility-ldbl.cc
210169691Skan	$(LTCXXCOMPILE) -mlong-double-64 -c $<
211169691Skancompatibility-ldbl.o: compatibility-ldbl.cc
212169691Skan	$(CXXCOMPILE) -mlong-double-64 -c $<
213169691Skanendif
214169691Skan
21597403Sobrien# AM_CXXFLAGS needs to be in each subdirectory so that it can be
21697403Sobrien# modified in a per-library or per-sub-library way.  Need to manually
21797403Sobrien# set this option because CONFIG_CXXFLAGS has to be after
21897403Sobrien# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
219132720Skan# as the occasion calls for it.
22097403SobrienAM_CXXFLAGS = \
22197403Sobrien	-fno-implicit-templates \
22297403Sobrien	$(WARN_CXXFLAGS) \
22397403Sobrien	$(OPTIMIZE_CXXFLAGS) \
224132720Skan	$(CONFIG_CXXFLAGS)
22597403Sobrien
22697403Sobrien
22797403Sobrien# libstdc++ libtool notes
22897403Sobrien
22997403Sobrien# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
23097403Sobrien# last. (That way, things like -O2 passed down from the toplevel can
23197403Sobrien# be overridden by --enable-debug.)
23297403Sobrien
23397403Sobrien# 2) In general, libtool expects an argument such as `--tag=CXX' when
23497403Sobrien# using the C++ compiler, because that will enable the settings
23597403Sobrien# detected when C++ support was being configured.  However, when no
23697403Sobrien# such flag is given in the command line, libtool attempts to figure
23797403Sobrien# it out by matching the compiler name in each configuration section
23897403Sobrien# against a prefix of the command line.  The problem is that, if the
23997403Sobrien# compiler name and its initial flags stored in the libtool
24097403Sobrien# configuration file don't match those in the command line, libtool
24197403Sobrien# can't decide which configuration to use, and it gives up.  The
24297403Sobrien# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
24397403Sobrien# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
24497403Sobrien# attempt to infer which configuration to use
24597403SobrienLTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
246169691Skan	       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
24797403Sobrien
248169691SkanLTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
249169691Skan
25097403Sobrien# 3) We'd have a problem when building the shared libstdc++ object if
25197403Sobrien# the rules automake generates would be used.  We cannot allow g++ to
25297403Sobrien# be used since this would add -lstdc++ to the link line which of
25397403Sobrien# course is problematic at this point.  So, we get the top-level
25497403Sobrien# directory to configure libstdc++-v3 to use gcc as the C++
25597403Sobrien# compilation driver.
25697403SobrienCXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
257169691Skan	  $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
258117397Skan
259117397Skan
260117397Skan# Added bits to build debug library.
261132720Skanif GLIBCXX_BUILD_DEBUG
262117397Skanall-local: build_debug
263117397Skaninstall-data-local: install_debug
264117397Skanelse
265117397Skanall-local:
266132720Skaninstall-data-local:
267117397Skanendif
268117397Skan
269117397Skandebugdir = debug
270117397Skan
271117397Skan# Build parallel set of debug objects here.
272132720Skanstamp-debug:
273117397Skan	if test ! -d ${debugdir}; then \
274117397Skan	  mkdir -p ${debugdir}; \
275117397Skan	  (cd ${debugdir}; \
276117397Skan	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
277117397Skan	      -e 's/srcdir = \.\./srcdir = ..\/../' \
278132720Skan	      -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
279117397Skan	      -e 's/all-local: build_debug/all-local:/' \
280117397Skan	      -e 's/install-data-local: install_debug/install-data-local:/' \
281117397Skan	  < ../Makefile > Makefile) ; \
282117397Skan	fi; \
283132720Skan	echo `date` > stamp-debug;
284117397Skan
285117397Skanbuild_debug: stamp-debug
286132720Skan	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
287117397Skan
288117397Skan# Install debug library here.
289132720Skaninstall_debug:
290117397Skan	(cd ${debugdir} && $(MAKE) \
291132720Skan	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
292