OSDN Git Service

701d5203ddc0c38365423c1be066d16d2e3ab26d
[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         debug.cc \
98         demangle.cc \
99         functexcept.cc \
100         globals_locale.cc \
101         globals_io.cc \
102         ios.cc \
103         ios_failure.cc \
104         ios_init.cc \
105         ios_locale.cc \
106         limits.cc \
107         locale.cc \
108         locale_init.cc \
109         locale_facets.cc \
110         localename.cc \
111         stdexcept.cc \
112         stl_tree.cc \
113         strstream.cc \
114         allocator-inst.cc \
115         concept-inst.cc \
116         fstream-inst.cc \
117         ext-inst.cc \
118         io-inst.cc \
119         istream-inst.cc \
120         locale-inst.cc \
121         locale-misc-inst.cc \
122         misc-inst.cc \
123         ostream-inst.cc \
124         sstream-inst.cc \
125         streambuf-inst.cc \
126         string-inst.cc \
127         valarray-inst.cc \
128         wlocale-inst.cc \
129         wstring-inst.cc \
130         ${host_sources} \
131         ${host_sources_extra}
132
133 VPATH = $(top_srcdir)/src:$(top_srcdir)
134
135 libstdc___la_SOURCES = $(sources)
136
137 libstdc___la_LIBADD = \
138         $(top_builddir)/libmath/libmath.la \
139         $(top_builddir)/libsupc++/libsupc++convenience.la
140
141 libstdc___la_DEPENDENCIES = ${version_dep} $(libstdc___la_LIBADD)
142
143 libstdc___la_LDFLAGS = \
144         -version-info $(libtool_VERSION) ${version_arg} \
145         -lm $(LIBUNWIND_FLAG)
146
147
148 # Use special rules for the deprecated source files so that they find
149 # deprecated include files.
150 GLIBCXX_INCLUDE_DIR=$(glibcxx_builddir)/include
151 strstream.lo: strstream.cc
152         $(LTCXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
153 strstream.o: strstream.cc
154         $(CXXCOMPILE) -I$(GLIBCXX_INCLUDE_DIR)/backward -Wno-deprecated -c $<
155
156 # Use special rules for the concept-checking instantiations so that all
157 # the generated template functions are also instantiated.  Force the checks
158 # to be on so that the instantiations are actually seen.
159 concept-inst.lo: concept-inst.cc
160         $(LTCXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
161 concept-inst.o: concept-inst.cc
162         $(CXXCOMPILE) -D_GLIBCXX_CONCEPT_CHECKS -fimplicit-templates -c $<
163
164 # Use special rules for the demangler, so that an additional implicit
165 # instantiation file is not necessary.
166 demangle.lo: demangle.cc
167         $(LTCXXCOMPILE) -fimplicit-templates -c $<
168 demangle.o: demangle.cc
169         $(CXXCOMPILE) -fimplicit-templates -c $<
170
171
172 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
173 # modified in a per-library or per-sub-library way.  Need to manually
174 # set this option because CONFIG_CXXFLAGS has to be after
175 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
176 # as the occasion calls for it.
177 AM_CXXFLAGS = \
178         -fno-implicit-templates \
179         $(WARN_CXXFLAGS) \
180         $(OPTIMIZE_CXXFLAGS) \
181         $(CONFIG_CXXFLAGS)
182
183
184 # libstdc++ libtool notes
185
186 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
187 # last. (That way, things like -O2 passed down from the toplevel can
188 # be overridden by --enable-debug.)
189
190 # 2) In general, libtool expects an argument such as `--tag=CXX' when
191 # using the C++ compiler, because that will enable the settings
192 # detected when C++ support was being configured.  However, when no
193 # such flag is given in the command line, libtool attempts to figure
194 # it out by matching the compiler name in each configuration section
195 # against a prefix of the command line.  The problem is that, if the
196 # compiler name and its initial flags stored in the libtool
197 # configuration file don't match those in the command line, libtool
198 # can't decide which configuration to use, and it gives up.  The
199 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
200 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
201 # attempt to infer which configuration to use
202 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
203                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
204
205 # 3) We'd have a problem when building the shared libstdc++ object if
206 # the rules automake generates would be used.  We cannot allow g++ to
207 # be used since this would add -lstdc++ to the link line which of
208 # course is problematic at this point.  So, we get the top-level
209 # directory to configure libstdc++-v3 to use gcc as the C++
210 # compilation driver.
211 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
212           $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
213
214
215 # Added bits to build debug library.
216 if GLIBCXX_BUILD_DEBUG
217 all-local: build_debug
218 install-data-local: install_debug
219 else
220 all-local:
221 install-data-local:
222 endif
223
224 debugdir = debug
225
226 # Build parallel set of debug objects here.
227 stamp-debug:
228         if test ! -d ${debugdir}; then \
229           mkdir -p ${debugdir}; \
230           (cd ${debugdir}; \
231           sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
232               -e 's/srcdir = \.\./srcdir = ..\/../' \
233               -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \
234               -e 's/all-local: build_debug/all-local:/' \
235               -e 's/install-data-local: install_debug/install-data-local:/' \
236           < ../Makefile > Makefile) ; \
237         fi; \
238         echo `date` > stamp-debug;
239
240 build_debug: stamp-debug
241         (cd ${debugdir} && $(MAKE) CXXFLAGS='$(DEBUG_FLAGS)' all)
242
243 # Install debug library here.
244 install_debug:
245         (cd ${debugdir} && $(MAKE) \
246         toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install)