OSDN Git Service

2001-05-18 Benjamin Kosnik <bkoz@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.84 2001/04/18 01:06:04 bkoz 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 CXX = @glibcpp_CXX@
33 toolexecdir = @glibcpp_toolexecdir@
34 toolexeclibdir = @glibcpp_toolexeclibdir@
35 toolexeclib_LTLIBRARIES = libstdc++.la
36
37 # Compile flags that should be constant throughout the build, both for
38 # SUBDIRS and for libstdc++-v3 in general.
39 OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
40
41 # These bits are all figured out from configure. Look in acinclude.m4
42 # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
43 # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
44 CONFIG_CXXFLAGS = \
45         @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ 
46
47 # Warning flags to use.
48 WARN_CXXFLAGS = \
49         @WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
50
51 # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
52 GLIBCPP_INCLUDE_DIR = @GLIBCPP_INCLUDE_DIR@
53 C_INCLUDE_DIR = @C_INCLUDE_DIR@
54 CSTD_INCLUDES = @CSTD_INCLUDES@
55 LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
56 LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
57 LIBIO_INCLUDES = @LIBIO_INCLUDES@
58 TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
59
60 INCLUDES = \
61         -nostdinc++ \
62         -I$(GLIBCPP_INCLUDE_DIR) $(CSTD_INCLUDES) -I$(top_builddir)/include \
63         $(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
64         $(TOPLEVEL_INCLUDES)
65
66 base_headers = \
67         bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h \
68         bits/stringfwd.h bits/std_string.h bits/basic_string.h \
69         bits/basic_string.tcc \
70         bits/generic_shadow.h bits/std_utility.h \
71         bits/std_complex.h \
72         bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
73         bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
74         bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
75         bits/std_fstream.h bits/std_iomanip.h \
76         bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
77         bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
78         bits/std_istream.h bits/istream.tcc bits/std_locale.h \
79         bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
80         bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
81         bits/streambuf.tcc bits/basic_file.h \
82         bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
83         bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
84         bits/stl_threads.h \
85         bits/stl_iterator_base_types.h bits/stl_iterator_base_funcs.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 bits/stl_stack.h bits/stl_tempbuf.h \
97         bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
98         bits/stl_bvector.h bits/type_traits.h bits/std_algorithm.h \
99         bits/stl_construct.h bits/boost_concept_check.h bits/concept_check.h
100
101
102 backward_headers = \
103         backward/complex.h backward/iomanip.h backward/istream.h \
104         backward/ostream.h backward/stream.h backward/streambuf.h \
105         backward/algo.h backward/algobase.h backward/alloc.h \
106         backward/bvector.h backward/defalloc.h backward/deque.h \
107         backward/function.h backward/hash_map.h backward/hash_set.h \
108         backward/hashtable.h backward/heap.h backward/iostream.h \
109         backward/iterator.h backward/list.h backward/map.h \
110         backward/multimap.h backward/new.h backward/multiset.h \
111         backward/pair.h backward/queue.h backward/rope.h backward/set.h \
112         backward/slist.h backward/stack.h backward/tempbuf.h backward/tree.h \
113         backward/vector.h backward/fstream.h backward/strstream.h \
114         backward/strstream backward/backward_warning.h
115
116 ext_headers = \
117         ext/rope ext/ropeimpl.h ext/stl_rope.h \
118         ext/slist ext/hash_map ext/hash_set \
119         ext/stl_hashtable.h ext/stl_hash_fun.h 
120
121 c_base_headers = \
122         bits/std_cassert.h bits/std_cctype.h bits/std_cerrno.h \
123         bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h \
124         bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h \
125         bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h \
126         bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h \
127         bits/std_cwchar.h bits/std_cwctype.h bits/cmath.tcc
128
129 if GLIBCPP_USE_CSHADOW
130 c_shadow_headers = \
131         assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h \
132         signal.h stdarg.h stddef.h stdio.h stdlib.h string.h time.h wchar.h \
133         wctype.h fcntl.h libio.h iolibio.h libioP.h pthread.h iconv.h \
134         features.h langinfo.h \
135         bits/wrap_libio.h bits/wrap_iolibio.h bits/wrap_libioP.h \
136         bits/wrap_iconv.h bits/wrap_fcntl.h bits/wrap_pthread.h \
137         bits/wrap_features.h bits/wrap_langinfo.h \
138         sys/cdefs.h 
139 else
140 c_shadow_headers =
141 endif
142
143 std_headers = \
144         algorithm bitset complex deque fstream functional \
145         iomanip ios iosfwd iostream istream iterator limits list locale \
146         map memory numeric ostream queue set sstream stack stdexcept \
147         streambuf string utility valarray vector \
148         cassert cctype cerrno cfloat climits clocale ciso646 \
149         cmath csetjmp csignal cstdarg cstddef cstdio cstdlib \
150         cstring ctime cwchar cwctype
151
152 if GLIBCPP_NEED_LIBIO 
153 libio_headers = \
154         $(top_srcdir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
155 else
156 libio_headers =
157 endif
158
159 build_headers = \
160         bits/std_limits.h \
161         bits/c++config.h bits/c++io.h bits/c++locale.h bits/c++threads.h \
162         bits/basic_file_model.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         basic_file.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 \
173         string-inst.cc wstring-inst.cc 
174
175
176 VPATH += $(top_srcdir) $(top_srcdir)/src
177 VPATH += $(GLIBCPP_INCLUDE_DIR) 
178 VPATH += $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR)
179
180 libstdc___la_SOURCES = $(sources)
181
182 libstdc___la_LIBADD = \
183         ../libmath/libmath.la @libio_la@ \
184         ../libsupc++/libsupc++convenience.la
185
186 libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
187
188 libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
189
190
191 # Use special rules for the deprecated source files so that they find
192 # deprecated include files.
193 strstream.lo: strstream.cc
194         $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
195 strstream.o: strstream.cc
196         $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
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)/backward; \
239         $(mkinstalldirs) $(DESTDIR)$(gxx_include_dir)/bits; \
240         $(mkinstalldirs) $(DESTDIR)$(gxx_include_dir)/ext; \
241         $(mkinstalldirs) $(DESTDIR)$(gxx_target_include_dir)/bits; \
242         fi
243
244 # NB: As libio_headers may be empty, need this to make sure bash doesn't
245 # choke on an empty for... loop by using libio_headers_install
246 # NB: installation of shadow headers is not attempted.
247 src_incdir = @GLIBCPP_INCLUDE_DIR@
248 bld_incdir = $(top_builddir)/include
249 c_incdir = @C_INCLUDE_DIR@
250 myinstallheaders: 
251         if test -z "$(MULTISUBDIR)"; then \
252         for i in $(base_headers); do \
253         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/bits/";\
254           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/bits/; \
255         done; \
256         for i in $(ext_headers); do \
257         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/ext/";\
258           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/ext/; \
259         done; \
260         for i in $(backward_headers); do \
261         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/backward/";\
262           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/backward/; \
263         done; \
264         for i in $(c_base_headers); do \
265         echo "$(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/";\
266           $(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/; \
267         done; \
268         for i in $(std_headers); do \
269         echo "$(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir)";\
270           $(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir); \
271         done; \
272         for i in $(build_headers); do \
273         echo "$(INSTALL_DATA) $(bld_incdir)/$$i \
274           $(gxx_target_include_dir)/bits/"; $(INSTALL_DATA) \
275           $(bld_incdir)/$$i $(gxx_target_include_dir)/bits/; \
276         done; \
277         libio_headers_install='$(libio_headers)'; \
278         for i in $$libio_headers_install; do \
279         echo "$(INSTALL_DATA) $$i $(gxx_include_dir)"; \
280           $(INSTALL_DATA) $$i $(gxx_include_dir); \
281         done; \
282         fi;
283
284
285 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
286 # modified in a per-library or per-sub-library way.  Need to manually
287 # set this option because CONFIG_CXXFLAGS has to be after
288 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
289 # as the occasion call for it. (ie, --enable-debug)
290 #
291 # The no-implicit-templates flag will generate unresolved references to
292 # the concept-checking symbols.  So we must disable the checks while
293 # actually building the library.
294 AM_CXXFLAGS = \
295         -fno-implicit-templates \
296         $(LIBSUPCXX_CXXFLAGS) \
297         $(WARN_CXXFLAGS) \
298         $(OPTIMIZE_CXXFLAGS) \
299         $(CONFIG_CXXFLAGS) 
300
301
302 # libstdc++ libtool notes
303
304 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
305 # last. (That way, things like -O2 passed down from the toplevel can
306 # be overridden by --enable-debug.)
307
308 # 2) In general, libtool expects an argument such as `--tag=CXX' when
309 # using the C++ compiler, because that will enable the settings
310 # detected when C++ support was being configured.  However, when no
311 # such flag is given in the command line, libtool attempts to figure
312 # it out by matching the compiler name in each configuration section
313 # against a prefix of the command line.  The problem is that, if the
314 # compiler name and its initial flags stored in the libtool
315 # configuration file don't match those in the command line, libtool
316 # can't decide which configuration to use, and it gives up.  The
317 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
318 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
319 # attempt to infer which configuration to use
320 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
321                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
322
323 # 3) We'd have a problem when building the shared libstdc++ object if
324 # the rules automake generates would be used.  We cannot allow g++ to
325 # be used since this would add -lstdc++ to the link line which of
326 # course is problematic at this point.  So, we get the top-level
327 # directory to configure libstdc++-v3 to use gcc as the C++
328 # compilation driver.
329 CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
330           @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@