re PR libstdc++/16614 (Excessive resource usage in __mt_alloc)
[gcc.git] / libstdc++-v3 / src / Makefile.am
1 ## Makefile for the src subdirectory of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 ## Free Software Foundation, Inc.
5 ##
6 ## This file is part of the libstdc++ version 3 distribution.
7 ## Process this file with automake to produce Makefile.in.
8
9 ## This file is part of the GNU ISO C++ Library. This library is free
10 ## software; you can redistribute it and/or modify it under the
11 ## terms of the GNU General Public License as published by the
12 ## Free Software Foundation; either version 2, or (at your option)
13 ## any later version.
14
15 ## This library is distributed in the hope that it will be useful,
16 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ## GNU General Public License for more details.
19
20 ## You should have received a copy of the GNU General Public License along
21 ## with this library; see the file COPYING. If not, write to the Free
22 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23 ## USA.
24
25 include $(top_srcdir)/fragment.am
26
27 # Cross compiler support.
28 toolexeclib_LTLIBRARIES = libstdc++.la
29
30 # Symbol versioning for shared libraries.
31 if GLIBCXX_BUILD_VERSIONED_SHLIB
32 version_arg = -Wl,--version-script=libstdc++-symbol.ver
33 version_dep = libstdc++-symbol.ver
34 libstdc++-symbol.ver: ${glibcxx_srcdir}/$(SYMVER_MAP)
35 cp ${glibcxx_srcdir}/$(SYMVER_MAP) ./libstdc++-symbol.ver
36 if test "x$(port_specific_symbol_files)" != x; then \
37 sed -n '1,/DO NOT DELETE/p' $@ > tmp.top; \
38 sed -n '/DO NOT DELETE/,$$p' $@ > tmp.bottom; \
39 cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@; \
40 rm tmp.top tmp.bottom; \
41 fi
42 else
43 version_arg =
44 version_dep =
45 endif
46
47
48 # Source files linked in via configuration/make substitution for a
49 # particular host.
50 host_sources = \
51 atomicity.cc \
52 codecvt_members.cc \
53 collate_members.cc \
54 ctype_members.cc \
55 messages_members.cc \
56 monetary_members.cc \
57 numeric_members.cc \
58 time_members.cc
59
60 codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
61 $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
62
63 collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
64 $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
65
66 ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
67 $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
68
69 messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
70 $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
71
72 monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
73 $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
74
75 numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
76 $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
77
78 time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
79 $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
80
81 atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
82 atomicity.cc: ${atomicity_file}
83 $(LN_S) ${atomicity_file} ./atomicity.cc || true
84
85 # Source files linked in via configuration/make substitution for a
86 # particular host, but with ad hoc naming rules.
87 host_sources_extra = \
88 basic_file.cc \
89 c++locale.cc
90
91 c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
92 $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
93
94 basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
95 $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
96
97 # Sources present in the src directory.
98 sources = \
99 pool_allocator.cc \
100 mt_allocator.cc \
101 codecvt.cc \
102 complex_io.cc \
103 ctype.cc \
104 debug.cc \
105 debug_list.cc \
106 functexcept.cc \
107 globals_locale.cc \
108 globals_io.cc \
109 ios.cc \
110 ios_failure.cc \
111 ios_init.cc \
112 ios_locale.cc \
113 limits.cc \
114 list.cc \
115 locale.cc \
116 locale_init.cc \
117 locale_facets.cc \
118 localename.cc \
119 stdexcept.cc \
120 strstream.cc \
121 tree.cc \
122 allocator-inst.cc \
123 concept-inst.cc \
124 fstream-inst.cc \
125 ext-inst.cc \
126 io-inst.cc \
127 istream-inst.cc \
128 locale-inst.cc \
129 locale-misc-inst.cc \
130 misc-inst.cc \
131 ostream-inst.cc \
132 sstream-inst.cc \
133 streambuf-inst.cc \
134 string-inst.cc \
135 valarray-inst.cc \
136 wlocale-inst.cc \
137 wstring-inst.cc \
138 ${host_sources} \
139 ${host_sources_extra}
140
141 VPATH = $(top_srcdir)/src:$(top_srcdir)
142
143 libstdc___la_SOURCES = $(sources)
144
145 libstdc___la_LIBADD = \
146 $(top_builddir)/libmath/libmath.la \
147 $(top_builddir)/libsupc++/libsupc++convenience.la
148
149 libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
150
151 libstdc___la_LDFLAGS = \
152 -version-info $(libtool_VERSION) ${version_arg} -lm
153
154
155 # Use special rules for the deprecated source files so that they find
156 # deprecated include files.
157 GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
158 strstream.lo: strstream.cc
159 $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
160 strstream.o: strstream.cc
161 $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
162
163 # Use special rules for the concept-checking instantiations so that all
164 # the generated template functions are also instantiated. Force the checks
165 # to be on so that the instantiations are actually seen.
166 concept-inst.lo: concept-inst.cc
167 $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
168 concept-inst.o: concept-inst.cc
169 $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
170
171 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
172 # modified in a per-library or per-sub-library way. Need to manually
173 # set this option because CONFIG_CXXFLAGS has to be after
174 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
175 # as the occasion calls for it.
176 AM_CXXFLAGS = \
177 -fno-implicit-templates \
178 $(WARN_CXXFLAGS) \
179 $(OPTIMIZE_CXXFLAGS) \
180 $(CONFIG_CXXFLAGS)
181
182
183 # libstdc++ libtool notes
184
185 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
186 # last. (That way, things like -O2 passed down from the toplevel can
187 # be overridden by --enable-debug.)
188
189 # 2) In general, libtool expects an argument such as `--tag=CXX' when
190 # using the C++ compiler, because that will enable the settings
191 # detected when C++ support was being configured. However, when no
192 # such flag is given in the command line, libtool attempts to figure
193 # it out by matching the compiler name in each configuration section
194 # against a prefix of the command line. The problem is that, if the
195 # compiler name and its initial flags stored in the libtool
196 # configuration file don't match those in the command line, libtool
197 # can't decide which configuration to use, and it gives up. The
198 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
199 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
200 # attempt to infer which configuration to use
201 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
202 $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
203
204 # 3) We'd have a problem when building the shared libstdc++ object if
205 # the rules automake generates would be used. We cannot allow g++ to
206 # be used since this would add -lstdc++ to the link line which of
207 # course is problematic at this point. So, we get the top-level
208 # directory to configure libstdc++-v3 to use gcc as the C++
209 # compilation driver.
210 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
211 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
212
213
214 # Added bits to build debug library.
215 if GLIBCXX_BUILD_DEBUG
216 all-local: build_debug
217 install-data-local: install_debug
218 else
219 all-local:
220 install-data-local:
221 endif
222
223 debugdir = debug
224
225 # Build parallel set of debug objects here.
226 stamp-debug:
227 if test ! -d ${debugdir}; then \
228 mkdir -p ${debugdir}; \
229 (cd ${debugdir}; \
230 sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
231 -e 's/srcdir = \.\./srcdir = ..\/../' \
232 -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
233 -e 's/all-local: build_debug/all-local:/' \
234 -e 's/install-data-local: install_debug/install-data-local:/' \
235 < ../Makefile > Makefile) ; \
236 fi; \
237 echo `date` > stamp-debug;
238
239 build_debug: stamp-debug
240 (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
241
242 # Install debug library here.
243 install_debug:
244 (cd ${debugdir} && $(MAKE) \
245 toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)