OSDN Git Service

2003-11-07 Jonathan Wakely <redi@gcc.gnu.org>
[pf3gnuchains/gcc-fork.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         codecvt_members.cc \
52         collate_members.cc \
53         ctype_members.cc \
54         messages_members.cc \
55         monetary_members.cc \
56         numeric_members.cc \
57         time_members.cc
58
59 codecvt_members.cc: ${glibcxx_srcdir}/$(CCODECVT_CC)
60         $(LN_S) ${glibcxx_srcdir}/$(CCODECVT_CC) . || true
61
62 collate_members.cc: ${glibcxx_srcdir}/$(CCOLLATE_CC)
63         $(LN_S) ${glibcxx_srcdir}/$(CCOLLATE_CC) . || true
64
65 ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
66         $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
67
68 messages_members.cc: ${glibcxx_srcdir}/$(CMESSAGES_CC)
69         $(LN_S) ${glibcxx_srcdir}/$(CMESSAGES_CC) . || true
70
71 monetary_members.cc: ${glibcxx_srcdir}/$(CMONEY_CC)
72         $(LN_S) ${glibcxx_srcdir}/$(CMONEY_CC) . || true
73
74 numeric_members.cc: ${glibcxx_srcdir}/$(CNUMERIC_CC)
75         $(LN_S) ${glibcxx_srcdir}/$(CNUMERIC_CC) . || true
76
77 time_members.cc: ${glibcxx_srcdir}/$(CTIME_CC)
78         $(LN_S) ${glibcxx_srcdir}/$(CTIME_CC) . || true
79
80 # Source files linked in via configuration/make substitution for a
81 # particular host, but with ad hoc naming rules.
82 host_sources_extra = \
83         basic_file.cc \
84         c++locale.cc
85
86 c++locale.cc: ${glibcxx_srcdir}/$(CLOCALE_CC)
87         $(LN_S) ${glibcxx_srcdir}/$(CLOCALE_CC) ./$@ || true
88
89 basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
90         $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
91
92 # Sources present in the src directory.
93 sources = \
94         codecvt.cc \
95         complex_io.cc \
96         ctype.cc \
97         demangle.cc \
98         functexcept.cc \
99         globals_locale.cc \
100         globals_io.cc \
101         ios.cc \
102         ios_failure.cc \
103         ios_init.cc \
104         ios_locale.cc \
105         limits.cc \
106         locale.cc \
107         locale_init.cc \
108         locale_facets.cc \
109         localename.cc \
110         stdexcept.cc \
111         stl_tree.cc \
112         strstream.cc \
113         allocator-inst.cc \
114         concept-inst.cc \
115         fstream-inst.cc \
116         ext-inst.cc \
117         io-inst.cc \
118         istream-inst.cc \
119         locale-inst.cc \
120         locale-misc-inst.cc \
121         misc-inst.cc \
122         ostream-inst.cc \
123         sstream-inst.cc \
124         streambuf-inst.cc \
125         string-inst.cc \
126         valarray-inst.cc \
127         wlocale-inst.cc \
128         wstring-inst.cc \
129         ${host_sources} \
130         ${host_sources_extra}
131
132 VPATH = $(top_srcdir)/src:$(top_srcdir)
133
134 libstdc___la_SOURCES = $(sources)
135
136 libstdc___la_LIBADD = \
137         $(top_builddir)/libmath/libmath.la \
138         $(top_builddir)/libsupc++/libsupc++convenience.la
139
140 libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
141
142 libstdc___la_LDFLAGS = \
143         -version-info $(libtool_VERSION) ${version_arg} \
144         -lm $(LIBUNWIND_FLAG)
145
146
147 # Use special rules for the deprecated source files so that they find
148 # deprecated include files.
149 GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
150 strstream.lo: strstream.cc
151         $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
152 strstream.o: strstream.cc
153         $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
154
155 # Use special rules for the concept-checking instantiations so that all
156 # the generated template functions are also instantiated.  Force the checks
157 # to be on so that the instantiations are actually seen.
158 concept-inst.lo: concept-inst.cc
159         $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
160 concept-inst.o: concept-inst.cc
161         $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
162
163 # Use special rules for the demangler, so that an additional implicit
164 # instantiation file is not necessary.
165 demangle.lo: demangle.cc
166         $(LTCXXCOMPILE) -fimplicit-templates -c $<
167 demangle.o: demangle.cc
168         $(CXXCOMPILE) -fimplicit-templates -c $<
169
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)