OSDN Git Service

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