OSDN Git Service

2001-02-07 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.70 2001/02/07 01:54:21 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 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) @WFMT_FLAGS@
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/exception_support.h \
77         bits/std_fstream.h bits/std_iomanip.h \
78         bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
79         bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
80         bits/std_istream.h bits/istream.tcc bits/std_locale.h \
81         bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
82         bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
83         bits/streambuf.tcc bits/basic_file.h \
84         bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
85         bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
86         bits/stl_threads.h bits/stl_iterator_base.h \
87         bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
88         bits/std_iterator.h bits/std_list.h \
89         bits/std_map.h bits/std_memory.h bits/std_numeric.h \
90         bits/std_queue.h bits/std_set.h bits/std_stack.h \
91         bits/std_stdexcept.h bits/std_vector.h \
92         bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
93         bits/stl_deque.h bits/stl_function.h \
94         bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
95         bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
96         bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
97         bits/stl_relops.h bits/stl_set.h \
98         bits/stl_stack.h bits/stl_tempbuf.h \
99         bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
100         bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \
101         bits/concept_checks.h bits/container_concepts.h \
102         bits/sequence_concepts.h bits/stl_config.h bits/stl_construct.h
103
104 backward_headers = \
105         backward/complex.h backward/iomanip.h backward/istream.h \
106         backward/ostream.h backward/stream.h backward/streambuf.h \
107         backward/algo.h backward/algobase.h backward/alloc.h \
108         backward/bvector.h backward/defalloc.h backward/deque.h \
109         backward/function.h backward/hash_map.h backward/hash_set.h \
110         backward/hashtable.h backward/heap.h backward/iterator.h \
111         backward/list.h backward/map.h backward/multimap.h backward/new.h \
112         backward/multiset.h backward/pair.h backward/iostream.h \
113         backward/rope.h backward/set.h backward/slist.h backward/stack.h \
114         backward/tempbuf.h backward/tree.h backward/vector.h \
115         backward/fstream.h backward/strstream.h backward/strstream
116
117 ext_headers = \
118         ext/ropeimpl.h ext/stl_rope.h \
119         ext/stl_bvector.h ext/stl_hashtable.h ext/stl_hash_fun.h \
120         ext/hash_map ext/hash_set ext/rope ext/slist \
121         ext/tree ext/bvector 
122
123 c_base_headers = \
124         bits/std_cassert.h bits/std_cctype.h bits/std_cerrno.h \
125         bits/std_cfloat.h bits/std_climits.h bits/std_clocale.h \
126         bits/std_cmath.h bits/std_csetjmp.h bits/std_csignal.h \
127         bits/std_cstdarg.h bits/std_cstddef.h bits/std_cstdio.h \
128         bits/std_cstdlib.h bits/std_cstring.h bits/std_ctime.h \
129         bits/std_cwchar.h bits/std_cwctype.h bits/cmath.tcc
130
131 if GLIBCPP_USE_CSHADOW
132 c_shadow_headers = \
133         assert.h ctype.h errno.h float.h limits.h locale.h math.h setjmp.h \
134         signal.h stdarg.h stddef.h stdio.h stdlib.h string.h time.h wchar.h \
135         wctype.h fcntl.h libio.h iolibio.h libioP.h pthread.h iconv.h \
136         features.h langinfo.h \
137         bits/wrap_libio.h bits/wrap_iolibio.h bits/wrap_libioP.h \
138         bits/wrap_iconv.h bits/wrap_fcntl.h bits/wrap_pthread.h \
139         bits/wrap_features.h bits/wrap_langinfo.h \
140         sys/cdefs.h 
141 else
142 c_shadow_headers =
143 endif
144
145 std_headers = \
146         algorithm bitset complex deque fstream functional \
147         iomanip ios iosfwd iostream istream iterator limits list locale \
148         map memory numeric ostream queue set sstream stack stdexcept \
149         streambuf string utility valarray vector \
150         cassert cctype cerrno cfloat climits clocale ciso646 \
151         cmath csetjmp csignal cstdarg cstddef cstdio cstdlib \
152         cstring ctime cwchar cwctype
153
154 if GLIBCPP_NEED_LIBIO 
155 libio_headers = \
156         $(top_srcdir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
157 else
158 libio_headers =
159 endif
160
161 build_headers = \
162         bits/std_limits.h \
163         bits/c++config.h bits/c++io.h bits/c++locale.h bits/c++threads.h \
164         bits/atomicity.h bits/os_defines.h \
165         bits/ctype_base.h bits/ctype_noninline.h bits/ctype_inline.h 
166
167 sources = \
168         limitsMEMBERS.cc \
169         complex_io.cc \
170         stdexcept.cc bitset.cc \
171         globals.cc \
172         c++io.cc ios.cc strstream.cc \
173         c++locale.cc locale.cc localename.cc codecvt.cc \
174         locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
175
176 wstring_sources = \
177         wstring-inst.cc
178
179 VPATH += $(top_srcdir) $(top_srcdir)/src
180 VPATH += $(GLIBCPP_INCLUDE_DIR) 
181 VPATH += $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR)
182
183 # Actual sources for the distro, but don't build these.
184 #EXTRA_sources = string-inst.cc 
185
186 libstdc___la_SOURCES = $(sources)
187
188 libinst_wstring_la_SOURCES = $(wstring_sources)
189
190 libstdc___la_LIBADD = \
191         ../libmath/libmath.la @libio_la@ \
192         ../libsupc++/libsupc++convenience.la \
193         @libinst_wstring_la@
194
195 libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
196
197 libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
198
199
200 # Make sure cshadow headers are built first.
201 if GLIBCPP_USE_CSHADOW
202 CSHADOW_H = $(top_builddir)/stamp-cshadow
203 else
204 CSHADOW_H =
205 endif
206
207 # Specify that all *.o's depend on this.
208 $(libstdc___la_OBJECTS): $(CSHADOW_H)
209
210 $(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \
211                                $(top_srcdir)/mkcshadow
212         $(top_srcdir)/mkinclosure \
213         "-I $(top_builddir)/../../gcc/include -I /usr/include -G fcntl.h unistd.h" | $(top_srcdir)/mkcshadow;
214         rm -f  $(top_builddir)/stamp-cshadow 
215         echo "done" > $(top_builddir)/stamp-cshadow 
216
217
218 # Check for various configure bits that change where the headers get installed.
219 gxx_include_dir = @gxx_include_dir@
220 gxx_target_include_dir = $(gxx_include_dir)/$(target_alias)
221
222 # We have our own special, ridiculously complicated installation routine
223 # here, as automake/autoconf is currently brain-damaged when it comes
224 # to installing sub-directories of headers. In particular, we want to
225 # 1) install build headers from (blddir)/include/bits -> (install)/bits
226 # 2) install source headers from
227 #      (srcdir)/include/bits -> (install)/bits
228 #      (srcdir)/include/ext -> (install)/ext
229 #      (srcdir)/include/backward -> (install)/backward
230 #      ... and the always entertaining "C" compatibility bits
231 #      where * represents configure-time directory switching
232 #      (srcdir)/include/c* -> (install)/
233 #      (srcdir)/include/c*/bits -> (install)/bits
234 #      (srcdir)/include/c*/sys -> (install)/sys
235 install-data-local: myinstalldirs myinstallheaders
236
237 # NB: installation of shadow header directories is not attempted.
238 myinstalldirs:
239         if test -z "$(MULTISUBDIR)"; then \
240         $(mkinstalldirs) $(DESTDIR)$(gxx_include_dir)/bits; \
241         $(mkinstalldirs) $(DESTDIR)$(gxx_include_dir)/ext; \
242         $(mkinstalldirs) $(DESTDIR)$(gxx_target_include_dir)/bits; \
243         fi
244
245 # NB: As libio_headers may be empty, need this to make sure bash doesn't
246 # choke on an empty for... loop by using libio_headers_install
247 # NB: installation of shadow headers is not attempted.
248 src_incdir = @GLIBCPP_INCLUDE_DIR@
249 bld_incdir = $(top_builddir)/include
250 c_incdir = @C_INCLUDE_DIR@
251 myinstallheaders: 
252         if test -z "$(MULTISUBDIR)"; then \
253         for i in $(base_headers); do \
254         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/bits/"; \
255           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/bits/; \
256         done; \
257         for i in $(ext_headers); do \
258         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/ext/"; \
259           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)/ext/; \
260         done; \
261         for i in $(backward_headers); do \
262         echo "$(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir)"; \
263           $(INSTALL_DATA) $(src_incdir)/$$i $(gxx_include_dir); \
264         done; \
265         for i in $(c_base_headers); do \
266         echo "$(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/"; \
267           $(INSTALL_DATA) $(c_incdir)/$$i $(gxx_include_dir)/bits/; \
268         done; \
269         for i in $(std_headers); do \
270         echo "$(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir)";\
271           $(INSTALL_DATA) $(src_incdir)/std/$$i $(gxx_include_dir); \
272         done; \
273         for i in $(build_headers); do \
274     echo "$(INSTALL_DATA) $(bld_incdir)/$$i $(gxx_target_include_dir)/bits/"; \
275           $(INSTALL_DATA) $(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 # Use special rules for the deprecated source files so that they find
286 # deprecated include files.
287 strstream.lo: strstream.cc
288         $(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
289 strstream.o: strstream.cc
290         $(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -c $<
291
292 # Make wstring-inst.cc from string-inst.cc
293 wstring-inst.o: string-inst.cc
294         $(CXXCOMPILE) -c -DC=wchar_t $< -o $@
295 wstring-inst.lo: string-inst.cc
296         $(LTCXXCOMPILE) -c -DC=wchar_t $< -o $@
297
298
299 # Alexandre put this in here for some libtool-related reason.
300 all: libstdc++.INC
301 libstdc++.INC: Makefile
302         $(MAKE) \
303         top_builddir=`CDPATH=:. && cd $(top_builddir) && pwd` \
304         top_srcdir=`CDPATH=:. && cd $(top_srcdir) && pwd` \
305         tmp-$@
306         -rm -f $@
307         mv tmp-$@ $@
308
309 tmp-libstdc++.INC: Makefile
310         echo $(INCLUDES) > $@
311
312
313 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
314 # modified in a per-library or per-sub-library way.  Need to manually
315 # set this option because CONFIG_CXXFLAGS has to be after
316 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
317 # as the occasion call for it. (ie, --enable-debug)
318 AM_CXXFLAGS = \
319         -fno-implicit-templates \
320         $(LIBSUPCXX_CXXFLAGS) \
321         $(WARN_CXXFLAGS) \
322         $(OPTIMIZE_CXXFLAGS) \
323         $(CONFIG_CXXFLAGS) 
324
325
326 # libstdc++ libtool notes
327
328 # 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
329 # last. (That way, things like -O2 passed down from the toplevel can
330 # be overridden by --enable-debug.)
331
332 # 2) In general, libtool expects an argument such as `--tag=CXX' when
333 # using the C++ compiler, because that will enable the settings
334 # detected when C++ support was being configured.  However, when no
335 # such flag is given in the command line, libtool attempts to figure
336 # it out by matching the compiler name in each configuration section
337 # against a prefix of the command line.  The problem is that, if the
338 # compiler name and its initial flags stored in the libtool
339 # configuration file don't match those in the command line, libtool
340 # can't decide which configuration to use, and it gives up.  The
341 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
342 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
343 # attempt to infer which configuration to use
344 LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
345                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
346
347 # 3) We have a problem when building the shared libstdc++ object if
348 # the rules automake generates would be used.  We cannot allow CXX to
349 # be used in libtool since this would add -lstdc++ to the link line
350 # which of course is problematic at this point.
351 CXXLINK = $(LIBTOOL) --mode=link "$(CC)" \
352           @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@