OSDN Git Service

2001-02-26 Phil Edwards <pme@sources.redhat.com>
[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 Free Software Foundation, Inc.
4 ##
5 ## This file is part of the libstdc++ version 3 distribution.
6 ## Process this file with automake to produce Makefile.in.
7
8 ## This file is part of the GNU ISO C++ Library.  This library is free
9 ## software; you can redistribute it and/or modify it under the
10 ## terms of the GNU General Public License as published by the
11 ## Free Software Foundation; either version 2, or (at your option)
12 ## any later version.
13
14 ## This library is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ## GNU General Public License for more details.
18
19 ## You should have received a copy of the GNU General Public License along
20 ## with this library; see the file COPYING.  If not, write to the Free
21 ## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
22 ## USA.
23
24 ## $Id: Makefile.am,v 1.73 2001/02/20 20:20:48 pme Exp $
25
26 AUTOMAKE_OPTIONS = 1.3 gnits
27 MAINT_CHARSET = latin1
28
29 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
30
31 # Cross compiler and multilib support.
32 toolexecdir = @glibcpp_toolexecdir@
33 toolexeclibdir = @glibcpp_toolexeclibdir@
34 toolexeclib_LTLIBRARIES = libstdc++.la
35 EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la
36
37
38 # Compile flags that should be constant throughout the build, both for
39 # SUBDIRS and for libstdc++-v3 in general.
40 OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
41
42 # These bits are all figured out from configure. Look in acinclude.m4
43 # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
44 # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
45 CONFIG_CXXFLAGS = \
46         @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ 
47
48 # Warning flags to use.
49 WARN_CXXFLAGS = \
50         @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
51
52 # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
53 GLIBCPP_INCLUDE_DIR = @GLIBCPP_INCLUDE_DIR@
54 C_INCLUDE_DIR = @C_INCLUDE_DIR@
55 CSTD_INCLUDES = @CSTD_INCLUDES@
56 LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
57 LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
58 LIBIO_INCLUDES = @LIBIO_INCLUDES@
59 TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
60
61 INCLUDES = \
62         -nostdinc++ \
63         -I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include \
64         $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
65         $(TOPLEVEL_INCLUDES)    
66
67 base_headers = \
68         bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h \
69         bits/stringfwd.h bits/std_string.h bits/basic_string.h \
70         bits/basic_string.tcc \
71         bits/generic_shadow.h bits/std_utility.h \
72         bits/std_complex.h \
73         bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
74         bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
75         bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
76         bits/std_fstream.h bits/std_iomanip.h \
77         bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
78         bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
79         bits/std_istream.h bits/istream.tcc bits/std_locale.h \
80         bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
81         bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
82         bits/streambuf.tcc bits/basic_file.h \
83         bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
84         bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
85         bits/stl_threads.h bits/stl_iterator_base.h \
86         bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
87         bits/std_iterator.h bits/std_list.h \
88         bits/std_map.h bits/std_memory.h bits/std_numeric.h \
89         bits/std_queue.h bits/std_set.h bits/std_stack.h \
90         bits/std_stdexcept.h bits/functexcept.h bits/std_vector.h \
91         bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
92         bits/stl_deque.h bits/stl_function.h \
93         bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
94         bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
95         bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
96         bits/stl_relops.h bits/stl_set.h \
97         bits/stl_stack.h bits/stl_tempbuf.h \
98         bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
99         bits/type_traits.h bits/std_algorithm.h \
100         bits/concept_checks.h bits/container_concepts.h \
101         bits/sequence_concepts.h bits/stl_construct.h
102
103 backward_headers = \
104         backward/complex.h backward/iomanip.h backward/istream.h \
105         backward/ostream.h backward/stream.h backward/streambuf.h \
106         backward/algo.h backward/algobase.h backward/alloc.h \
107         backward/bvector.h backward/defalloc.h backward/deque.h \
108         backward/function.h backward/hash_map.h backward/hash_set.h \
109         backward/hashtable.h backward/heap.h backward/iterator.h \
110         backward/list.h backward/map.h backward/multimap.h backward/new.h \
111         backward/multiset.h backward/pair.h backward/iostream.h \
112         backward/rope.h backward/set.h backward/slist.h backward/stack.h \
113         backward/tempbuf.h backward/tree.h backward/vector.h \
114         backward/fstream.h backward/strstream.h backward/strstream
115
116 ext_headers = \
117         ext/ropeimpl.h ext/stl_rope.h \
118         ext/stl_bvector.h ext/stl_hashtable.h ext/stl_hash_fun.h \
119         ext/hash_map ext/hash_set ext/rope ext/slist \
120         ext/tree ext/bvector 
121
122 c_base_headers = \
123         bits/std_cassert.h bits/std_cctype.h bits/std_cerrno.h \
124         bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h \
125         bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h \
126         bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h \
127         bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h \
128         bits/std_cwchar.h bits/std_cwctype.h bits/cmath.tcc
129
130 if GLIBCPP_USE_CSHADOW
131 c_shadow_headers = \
132         assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h \
133         signal.h stdarg.h stddef.h stdio.h stdlib.h string.h time.h wchar.h \
134         wctype.h fcntl.h libio.h iolibio.h libioP.h pthread.h iconv.h \
135         features.h langinfo.h \
136         bits/wrap_libio.h bits/wrap_iolibio.h bits/wrap_libioP.h \
137         bits/wrap_iconv.h bits/wrap_fcntl.h bits/wrap_pthread.h \
138         bits/wrap_features.h bits/wrap_langinfo.h \
139         sys/cdefs.h 
140 else
141 c_shadow_headers =
142 endif
143
144 std_headers = \
145         algorithm bitset complex deque fstream functional \
146         iomanip ios iosfwd iostream istream iterator limits list locale \
147         map memory numeric ostream queue set sstream stack stdexcept \
148         streambuf string utility valarray vector \
149         cassert cctype cerrno cfloat climits clocale ciso646 \
150         cmath csetjmp csignal cstdarg cstddef cstdio cstdlib \
151         cstring ctime cwchar cwctype
152
153 if GLIBCPP_NEED_LIBIO 
154 libio_headers = \
155         $(top_srcdir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
156 else
157 libio_headers =
158 endif
159
160 build_headers = \
161         bits/std_limits.h \
162         bits/c++config.h bits/c++io.h bits/c++locale.h bits/c++threads.h \
163         bits/atomicity.h bits/os_defines.h \
164         bits/ctype_base.h bits/ctype_noninline.h bits/ctype_inline.h 
165
166 sources = \
167         limitsMEMBERS.cc \
168         stdexcept.cc functexcept.cc bitset.cc \
169         globals.cc \
170         c++io.cc ios.cc complex_io.cc strstream.cc \
171         c++locale.cc locale.cc localename.cc codecvt.cc \
172         locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
173
174 wstring_sources = \
175         wstring-inst.cc
176
177 VPATH += $(top_srcdir) $(top_srcdir)/src
178 VPATH += $(GLIBCPP_INCLUDE_DIR) 
179 VPATH += $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR)
180
181 # Actual sources for the distro, but don't build these.
182 #EXTRA_sources = string-inst.cc 
183
184 libstdc___la_SOURCES = $(sources)
185
186 libinst_wstring_la_SOURCES = $(wstring_sources)
187
188 libstdc___la_LIBADD = \
189         ../libmath/libmath.la @libio_la@ \
190         ../libsupc++/libsupc++convenience.la \
191         @libinst_wstring_la@
192
193 libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
194
195 libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
196
197
198 # Make sure cshadow headers are built first.
199 if GLIBCPP_USE_CSHADOW
200 CSHADOW_H = $(top_builddir)/stamp-cshadow
201 else
202 CSHADOW_H =
203 endif
204
205 # Specify that all *.o's depend on this.
206 $(libstdc___la_OBJECTS): $(CSHADOW_H)
207
208 $(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \
209                                $(top_srcdir)/mkcshadow
210         $(top_srcdir)/mkinclosure \
211         "-I $(top_builddir)/../../gcc/include -I /usr/include -G fcntl.h unistd.h" | $(top_srcdir)/mkcshadow;
212         rm -f  $(top_builddir)/stamp-cshadow 
213         echo "done" > $(top_builddir)/stamp-cshadow 
214
215
216 # Check for various configure bits that change where the headers get installed.
217 gxx_include_dir = @gxx_include_dir@
218 gxx_target_include_dir = $(gxx_include_dir)/$(target_alias)
219
220 # We have our own special, ridiculously complicated installation routine
221 # here, as automake/autoconf is currently brain-damaged when it comes
222 # to installing sub-directories of headers. In particular, we want to
223 # 1) install build headers from (blddir)/include/bits -> (install)/bits
224 # 2) install source headers from
225 #      (srcdir)/include/bits -> (install)/bits
226 #      (srcdir)/include/ext -> (install)/ext
227 #      (srcdir)/include/backward -> (install)/backward
228 #      ... and the always entertaining "C" compatibility bits
229 #      where * represents configure-time directory switching
230 #      (srcdir)/include/c* -> (install)/
231 #      (srcdir)/include/c*/bits -> (install)/bits
232 #      (srcdir)/include/c*/sys -> (install)/sys
233 install-data-local: myinstalldirs myinstallheaders
234
235 # NB: installation of shadow header directories is not attempted.
236 myinstalldirs:
237         if test -z "$(MULTISUBDIR)"; then \
238         $(mkinstalldirs) $(DESTDIR)$(gxx_include_dir)/bits; \
239         $(mkinstalldirs) $(DESTDIR)$(gxx_include_dir)/ext; \
240         $(mkinstalldirs) $(DESTDIR)$(gxx_target_include_dir)/bits; \
241         fi
242
243 # NB: As libio_headers may be empty, need this to make sure bash doesn't
244 # choke on an empty for... loop by using libio_headers_install
245 # NB: installation of shadow headers is not attempted.
246 src_incdir = @GLIBCPP_INCLUDE_DIR@
247 bld_incdir = $(top_builddir)/include
248 c_incdir = @C_INCLUDE_DIR@
249 myinstallheaders: 
250         if test -z "$(MULTISUBDIR)"; then \
251         for i in $(base_headers); do \
252         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/bits/"; \
253           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/bits/; \
254         done; \
255         for i in $(ext_headers); do \
256         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/ext/"; \
257           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/ext/; \
258         done; \
259         for i in $(backward_headers); do \
260         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)"; \
261           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir); \
262         done; \
263         for i in $(c_base_headers); do \
264         echo "$(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/"; \
265           $(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/; \
266         done; \
267         for i in $(std_headers); do \
268         echo "$(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir)";\
269           $(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir); \
270         done; \
271         for i in $(build_headers); do \
272     echo "$(INSTALL_DATA) $(bld_incdir)/$$i $(gxx_target_include_dir)/bits/"; \
273           $(INSTALL_DATA) $(bld_incdir)/$$i $(gxx_target_include_dir)/bits/; \
274         done; \
275         libio_headers_install='$(libio_headers)'; \
276         for i in $$libio_headers_install; do \
277         echo "$(INSTALL_DATA) $$i $(gxx_include_dir)"; \
278           $(INSTALL_DATA) $$i $(gxx_include_dir); \
279         done; \
280         fi;
281
282
283 # Use special rules for the deprecated source files so that they find
284 # deprecated include files.
285 strstream.lo: strstream.cc
286         $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
287 strstream.o: strstream.cc
288         $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
289
290 # Make wstring-inst.cc from string-inst.cc
291 wstring-inst.o: string-inst.cc
292         $(CXXCOMPILE) -c -DC=wchar_t $< -o $@
293 wstring-inst.lo: string-inst.cc
294         $(LTCXXCOMPILE) -c -DC=wchar_t $< -o $@
295
296
297 # Alexandre put this in here for some libtool-related reason.
298 all: libstdc++.INC
299 libstdc++.INC: Makefile
300         $(MAKE) \
301         top_builddir=`CDPATH=:. && cd $(top_builddir) && pwd` \
302         top_srcdir=`CDPATH=:. && cd $(top_srcdir) && pwd` \
303         tmp-$@
304         -rm -f $@
305         mv tmp-$@ $@
306
307 tmp-libstdc++.INC: Makefile
308         echo $(INCLUDES) > $@
309
310
311 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
312 # modified in a per-library or per-sub-library way.  Need to manually
313 # set this option because CONFIG_CXXFLAGS has to be after
314 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
315 # as the occasion call for it. (ie, --enable-debug)
316 AM_CXXFLAGS = \
317         -fno-implicit-templates \
318         $(LIBSUPCXX_CXXFLAGS) \
319         $(WARN_CXXFLAGS) \
320         $(OPTIMIZE_CXXFLAGS) \
321         $(CONFIG_CXXFLAGS) 
322
323
324 # libstdc++ libtool notes
325
326 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
327 # last. (That way, things like -O2 passed down from the toplevel can
328 # be overridden by --enable-debug.)
329
330 # 2) In general, libtool expects an argument such as `--tag=CXX' when
331 # using the C++ compiler, because that will enable the settings
332 # detected when C++ support was being configured.  However, when no
333 # such flag is given in the command line, libtool attempts to figure
334 # it out by matching the compiler name in each configuration section
335 # against a prefix of the command line.  The problem is that, if the
336 # compiler name and its initial flags stored in the libtool
337 # configuration file don't match those in the command line, libtool
338 # can't decide which configuration to use, and it gives up.  The
339 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
340 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
341 # attempt to infer which configuration to use
342 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
343                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
344
345 # 3) We have a problem when building the shared libstdc++ object if
346 # the rules automake generates would be used.  We cannot allow CXX to
347 # be used in libtool since this would add -lstdc++ to the link line
348 # which of course is problematic at this point.
349 CXXLINK = $(LIBTOOL) --mode=link "$(CC)" \
350           @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@