Makefile.am revision 132720
197403Sobrien## Makefile for the src subdirectory of the GNU C++ Standard library.
297403Sobrien##
3117397Skan## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
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
2297403Sobrien## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2397403Sobrien## USA.
2497403Sobrien
25132720Skaninclude $(top_srcdir)/fragment.am
2697403Sobrien
27103447Skan# Cross compiler support.
2897403Sobrientoolexeclib_LTLIBRARIES = libstdc++.la
2997403Sobrien
30117397Skan# Symbol versioning for shared libraries.
31132720Skanif GLIBCXX_BUILD_VERSIONED_SHLIB
32117397Skanversion_arg = -Wl,--version-script=libstdc++-symbol.ver
33132720Skanversion_dep = libstdc++-symbol.ver
34132720Skanlibstdc++-symbol.ver:  ${glibcxx_srcdir}/$(SYMVER_MAP)
35132720Skan	cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
36132720Skan	if test "x$(port_specific_symbol_files)" != x; then \
37132720Skan	  sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
38132720Skan	  sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
39132720Skan	  cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
40132720Skan	  rm tmp.top tmp.bottom; \
41132720Skan	fi
42117397Skanelse
43117397Skanversion_arg =
44132720Skanversion_dep =
45117397Skanendif
46117397Skan
4797403Sobrien
48117397Skan# Source files linked in via configuration/make substitution for a
49132720Skan# particular host.
50132720Skanhost_sources = \
51132720Skan	atomicity.cc \
52103447Skan	codecvt_members.cc \
53103447Skan	collate_members.cc \
54103447Skan	ctype_members.cc \
55103447Skan	messages_members.cc \
56103447Skan	monetary_members.cc \
57103447Skan	numeric_members.cc \
58132720Skan	time_members.cc 
59103447Skan
60132720Skancodecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
61132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
62117397Skan
63132720Skancollate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
64132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
65117397Skan
66132720Skanctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
67132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
68117397Skan
69132720Skanmessages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
70132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
71117397Skan
72132720Skanmonetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
73132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
74117397Skan
75132720Skannumeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
76132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
77117397Skan
78132720Skantime_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
79132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
80117397Skan
81132720Skanatomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
82132720Skanatomicity.cc: ${atomicity_file}
83132720Skan	$(LN_S) ${atomicity_file} ./atomicity.cc || true
84132720Skan
85117397Skan# Source files linked in via configuration/make substitution for a
86132720Skan# particular host, but with ad hoc naming rules.
87132720Skanhost_sources_extra = \
88103447Skan	basic_file.cc \
89132720Skan	c++locale.cc
90103447Skan
91132720Skanc++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
92132720Skan	$(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
93117397Skan
94132720Skanbasic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
95132720Skan	$(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
96117397Skan
97103447Skan# Sources present in the src directory.
9897403Sobriensources = \
99132720Skan	allocator.cc \
100103447Skan	codecvt.cc \
101103447Skan	complex_io.cc \
102103447Skan	ctype.cc \
103132720Skan	debug.cc \
104132720Skan	debug_list.cc \
105103447Skan	functexcept.cc \
106132720Skan	globals_locale.cc \
107132720Skan	globals_io.cc \
108103447Skan	ios.cc \
109132720Skan	ios_failure.cc \
110132720Skan	ios_init.cc \
111132720Skan	ios_locale.cc \
112103447Skan	limits.cc \
113132720Skan	list.cc \
114103447Skan	locale.cc \
115132720Skan	locale_init.cc \
116132720Skan	locale_facets.cc \
117132720Skan	localename.cc \
118132720Skan	stdexcept.cc \
119132720Skan	strstream.cc \
120132720Skan	tree.cc \
121132720Skan	allocator-inst.cc \
122132720Skan	concept-inst.cc \
123132720Skan	fstream-inst.cc \
124132720Skan	ext-inst.cc \
125132720Skan	io-inst.cc \
126132720Skan	istream-inst.cc \
127103447Skan	locale-inst.cc \
128132720Skan	locale-misc-inst.cc \
129103447Skan	misc-inst.cc \
130103447Skan	ostream-inst.cc \
131103447Skan	sstream-inst.cc \
132103447Skan	streambuf-inst.cc \
133103447Skan	string-inst.cc \
134103447Skan	valarray-inst.cc \
135132720Skan	wlocale-inst.cc \
136103447Skan	wstring-inst.cc \
137132720Skan	${host_sources} \
138132720Skan	${host_sources_extra}
13997403Sobrien
14097403SobrienVPATH = $(top_srcdir)/src:$(top_srcdir)
14197403Sobrien
14297403Sobrienlibstdc___la_SOURCES = $(sources)
14397403Sobrien
14497403Sobrienlibstdc___la_LIBADD = \
145132720Skan	$(top_builddir)/libmath/libmath.la \
146117397Skan	$(top_builddir)/libsupc++/libsupc++convenience.la
14797403Sobrien
148132720Skanlibstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
14997403Sobrien
15097403Sobrienlibstdc___la_LDFLAGS = \
151132720Skan	-version-info $(libtool_VERSION) ${version_arg} -lm 
15297403Sobrien
15397403Sobrien
15497403Sobrien# Use special rules for the deprecated source files so that they find
15597403Sobrien# deprecated include files.
156132720SkanGLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
15797403Sobrienstrstream.lo: strstream.cc
158132720Skan	$(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
15997403Sobrienstrstream.o: strstream.cc
160132720Skan	$(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
16197403Sobrien
16297403Sobrien# Use special rules for the concept-checking instantiations so that all
16397403Sobrien# the generated template functions are also instantiated.  Force the checks
16497403Sobrien# to be on so that the instantiations are actually seen.
16597403Sobrienconcept-inst.lo: concept-inst.cc
166132720Skan	$(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
16797403Sobrienconcept-inst.o: concept-inst.cc
168132720Skan	$(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
16997403Sobrien
17097403Sobrien# AM_CXXFLAGS needs to be in each subdirectory so that it can be
17197403Sobrien# modified in a per-library or per-sub-library way.  Need to manually
17297403Sobrien# set this option because CONFIG_CXXFLAGS has to be after
17397403Sobrien# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
174132720Skan# as the occasion calls for it.
17597403SobrienAM_CXXFLAGS = \
17697403Sobrien	-fno-implicit-templates \
17797403Sobrien	$(WARN_CXXFLAGS) \
17897403Sobrien	$(OPTIMIZE_CXXFLAGS) \
179132720Skan	$(CONFIG_CXXFLAGS)
18097403Sobrien
18197403Sobrien
18297403Sobrien# libstdc++ libtool notes
18397403Sobrien
18497403Sobrien# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
18597403Sobrien# last. (That way, things like -O2 passed down from the toplevel can
18697403Sobrien# be overridden by --enable-debug.)
18797403Sobrien
18897403Sobrien# 2) In general, libtool expects an argument such as `--tag=CXX' when
18997403Sobrien# using the C++ compiler, because that will enable the settings
19097403Sobrien# detected when C++ support was being configured.  However, when no
19197403Sobrien# such flag is given in the command line, libtool attempts to figure
19297403Sobrien# it out by matching the compiler name in each configuration section
19397403Sobrien# against a prefix of the command line.  The problem is that, if the
19497403Sobrien# compiler name and its initial flags stored in the libtool
19597403Sobrien# configuration file don't match those in the command line, libtool
19697403Sobrien# can't decide which configuration to use, and it gives up.  The
19797403Sobrien# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
19897403Sobrien# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
19997403Sobrien# attempt to infer which configuration to use
20097403SobrienLTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
201132720Skan	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
20297403Sobrien
20397403Sobrien# 3) We'd have a problem when building the shared libstdc++ object if
20497403Sobrien# the rules automake generates would be used.  We cannot allow g++ to
20597403Sobrien# be used since this would add -lstdc++ to the link line which of
20697403Sobrien# course is problematic at this point.  So, we get the top-level
20797403Sobrien# directory to configure libstdc++-v3 to use gcc as the C++
20897403Sobrien# compilation driver.
20997403SobrienCXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
210132720Skan	  $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
211117397Skan
212117397Skan
213117397Skan# Added bits to build debug library.
214132720Skanif GLIBCXX_BUILD_DEBUG
215117397Skanall-local: build_debug
216117397Skaninstall-data-local: install_debug
217117397Skanelse
218117397Skanall-local:
219132720Skaninstall-data-local:
220117397Skanendif
221117397Skan
222117397Skandebugdir = debug
223117397Skan
224117397Skan# Build parallel set of debug objects here.
225132720Skanstamp-debug:
226117397Skan	if test ! -d ${debugdir}; then \
227117397Skan	  mkdir -p ${debugdir}; \
228117397Skan	  (cd ${debugdir}; \
229117397Skan	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
230117397Skan	      -e 's/srcdir = \.\./srcdir = ..\/../' \
231132720Skan	      -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
232117397Skan	      -e 's/all-local: build_debug/all-local:/' \
233117397Skan	      -e 's/install-data-local: install_debug/install-data-local:/' \
234117397Skan	  < ../Makefile > Makefile) ; \
235117397Skan	fi; \
236132720Skan	echo `date` > stamp-debug;
237117397Skan
238117397Skanbuild_debug: stamp-debug
239132720Skan	(cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
240117397Skan
241117397Skan# Install debug library here.
242132720Skaninstall_debug:
243117397Skan	(cd ${debugdir} && $(MAKE) \
244132720Skan	toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)
245