OSDN Git Service

c211aa259a03980c4e5c8a89ee51564f80b32567
[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 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.33 2000/10/05 11:36:52 bkoz Exp $
25
26 AUTOMAKE_OPTIONS = 1.3 gnits
27 MAINT_CHARSET = latin1
28
29 # Cross compiler and multilib support.
30 # Install a library built with a cross compiler in tooldir, not libdir.
31 if USE_LIBDIR
32 toolexeclibdir = $(libdir)$(MULTISUBDIR)
33 else
34 toolexecdir = $(exec_prefix)/$(target_alias)
35 toolexeclibdir = $(toolexecdir)/lib$(MULTISUBDIR)
36 endif
37
38 toolexeclib_LTLIBRARIES = libstdc++.la
39 EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la
40
41
42 # Using these options is probably a good idea for thrill-seekers. Just
43 # uncomment the lines below and make, everything else is ready to go... 
44 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 
45
46 # These bits are all figured out from configure. Look in acinclude.m4
47 # or configure.in to see how they are set.
48 # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
49 AC_CXXFLAGS = \
50         $(WERROR) @WFMT_FLAGS@ @CPU_FLAGS@ @EXTRA_CXX_FLAGS@ \
51         @SECTION_FLAGS@ @CSHADOWFLAGS@ @DEBUG_FLAGS@ 
52
53 # Need to manually set this option because AC_CXXFLAGS has to be at
54 # the end of the compile line so that -O2 can be overridden as the
55 # occasion call for it. (ie, --enable-debug)
56 AM_CXXFLAGS = \
57         -fno-implicit-templates $(OPTIMIZE_CXXFLAGS) \
58         -Wall -Wno-format -W -Wwrite-strings -Winline \
59         $(AC_CXXFLAGS) 
60
61
62 # Root level of the include sources.
63 glibcpp_includedir = $(top_srcdir)/include
64
65 # Passed down for cross compilers, canadian crosses.
66 TOPLEVEL_INCLUDES = -I$(includedir)
67
68 LIBMATH_INCLUDES = -I$(top_srcdir)/math
69
70 if GLIBCPP_NEED_LIBIO
71 LIBIO_INCLUDES = \
72         -I$(top_builddir)/libio -I$(top_srcdir)/libio 
73 else
74 LIBIO_INCLUDES = -I$(top_srcdir)/libio
75 endif
76
77 if GLIBCPP_USE_CSHADOW
78 #CSHADOW_INCLUDES = \
79 #       -I$(glibcpp_includedir)/std -I$(top_srcdir)/shadow -I$(top_builddir)/cshadow
80 CSHADOW_INCLUDES = \
81         -I$(glibcpp_includedir)/std -I$(top_srcdir)/shadow 
82 else
83 CSHADOW_INCLUDES =
84 endif
85
86 CONFIG_INCLUDES = \
87         -I$(top_srcdir)/@cpu_include_dir@ \
88         -I$(top_srcdir)/@ctype_include_dir@
89
90 INCLUDES = \
91         -D_GNU_SOURCE -D_ISOC99_SOURCE -nostdinc++ $(CSHADOW_INCLUDES) \
92         -I$(top_builddir) -I$(glibcpp_includedir) \
93          $(CONFIG_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
94          $(TOPLEVEL_INCLUDES)   
95
96
97 # Need to explicitly set this so that AM_CXXFLAGS is last. In
98 # addition, we don't use $(DEFS), which tries to set $(top_srcdir) as
99 # an include diretory, which screws up shadow headers. (That way,
100 # things like -O2 passed down from the toplevel can be overridden by
101 # --enable-debug.)
102 CXXCOMPILE = $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
103              $(CXXFLAGS) $(AM_CXXFLAGS) 
104
105 LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(INCLUDES) \
106                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
107
108 # We have a problem when building the shared libstdc++ object if the
109 # rules automake generates would be used.  We cannot allow CXX to be used
110 # in libtool since this would add -lstdc++ to the link line which of
111 # course is impossible.
112 CXXLINK = $(LIBTOOL) --mode=link "$(CC)" @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
113
114
115 headers = \
116         bits/cpp_type_traits.h \
117         bits/std_cctype.h bits/ctype_base.h bits/ctype_specializations.h \
118         bits/char_traits.h bits/codecvt.h \
119         bits/basic_string.h bits/std_string.h  bits/string.tcc \
120         bits/generic_shadow.h bits/std_utility.h \
121         bits/std_complex.h \
122         bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
123         bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
124         bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
125         bits/std_cassert.h bits/std_cwctype.h \
126         bits/std_cerrno.h bits/std_cfloat.h bits/std_climits.h \
127         bits/std_clocale.h bits/std_cmath.h \
128         bits/std_csetjmp.h bits/std_csignal.h bits/std_cstdarg.h \
129         bits/std_cstddef.h bits/std_cstdio.h bits/std_cstdlib.h \
130         bits/std_cstring.h bits/std_ctime.h bits/std_cwchar.h \
131         bits/std_typeinfo.h bits/std_new.h \
132         bits/std_exception.h bits/exception_support.h \
133         bits/std_fstream.h bits/std_iomanip.h \
134         bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
135         bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
136         bits/std_istream.h bits/istream.tcc bits/std_locale.h \
137         bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
138         bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
139         bits/streambuf.tcc bits/basic_file.h \
140         bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
141         bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
142         bits/stl_threads.h bits/stl_iterator_base.h \
143         backward/algo.h backward/algobase.h backward/alloc.h \
144         backward/bvector.h backward/defalloc.h backward/deque.h \
145         backward/function.h backward/hash_map.h backward/hash_set.h \
146         backward/hashtable.h backward/heap.h backward/iterator.h \
147         backward/list.h backward/map.h backward/multimap.h backward/new.h \
148         backward/multiset.h backward/pair.h backward/iostream.h \
149         backward/rope.h backward/set.h backward/slist.h backward/stack.h \
150         backward/tempbuf.h backward/tree.h backward/vector.h \
151         backward/fstream.h \
152         bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
153         bits/std_iterator.h bits/std_list.h \
154         bits/std_map.h bits/std_memory.h bits/std_numeric.h \
155         bits/std_queue.h bits/std_set.h bits/std_stack.h \
156         bits/std_stdexcept.h bits/std_vector.h \
157         bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
158         bits/stl_deque.h bits/stl_function.h \
159         bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
160         bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
161         bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
162         bits/stl_relops.h bits/stl_set.h \
163         bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \
164         bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
165         bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \
166         bits/concept_checks.h bits/container_concepts.h \
167         bits/sequence_concepts.h bits/std_strstream.h \
168         ext/ropeimpl.h ext/stl_rope.h \
169         ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h \
170         ext/stl_hashtable.h ext/stl_hash_fun.h \
171         ext/hash_map ext/hash_set ext/rope ext/slist \
172         ext/tree ext/bvector \
173         shadow/assert.h shadow/ctype.h shadow/errno.h shadow/float.h \
174         shadow/fcntl.h shadow/libio.h shadow/iolibio.h shadow/libioP.h \
175         shadow/limits.h shadow/locale.h shadow/math.h shadow/setjmp.h \
176         shadow/signal.h shadow/stdarg.h shadow/stddef.h shadow/stdio.h \
177         shadow/stdlib.h shadow/string.h shadow/time.h \
178         shadow/pthread.h shadow/iconv.h shadow/wchar.h shadow/wctype.h \
179         shadow/bits/std_cassert.h shadow/bits/std_cctype.h \
180         shadow/bits/std_cerrno.h shadow/bits/std_cfloat.h \
181         shadow/bits/std_climits.h shadow/bits/std_clocale.h \
182         shadow/bits/std_cmath.h shadow/bits/std_csetjmp.h \
183         shadow/bits/std_csignal.h shadow/bits/std_cstdarg.h \
184         shadow/bits/std_cstddef.h shadow/bits/std_cstdio.h \
185         shadow/bits/std_cstdlib.h shadow/bits/std_cstring.h \
186         shadow/bits/std_ctime.h shadow/bits/std_cwchar.h \
187         shadow/bits/std_cwctype.h \
188         shadow/bits/wrap_libio.h shadow/bits/wrap_iolibio.h \
189         shadow/bits/wrap_libioP.h shadow/bits/wrap_iconv.h \
190         shadow/bits/wrap_fcntl.h shadow/bits/wrap_pthread.h \
191         shadow/sys/cdefs.h 
192
193 std_headers = \
194         algorithm bitset cassert cctype cerrno cfloat climits clocale ciso646 \
195         cmath complex csetjmp csignal cstdarg cstddef cstdio cstdlib \
196         cstring ctime cwchar cwctype deque exception fstream functional \
197         iomanip ios iosfwd iostream istream iterator limits list locale \
198         map memory new numeric ostream queue set sstream stack stdexcept \
199         streambuf string strstream typeinfo utility valarray vector 
200
201 if GLIBCPP_NEED_LIBIO 
202 libio_headers = \
203         $(top_srcdir)/libio/_G_config.h $(top_srcdir)/libio/libio.h
204 else
205 libio_headers =
206 endif
207
208 generated_headers = \
209          $(top_builddir)/bits/std_limits.h $(top_builddir)/bits/c++config.h \
210          $(top_builddir)/bits/c++threads.h $(top_builddir)/bits/c++io.h
211
212 cpu_headers = \
213          $(top_srcdir)/@cpu_include_dir@/bits/atomicity.h 
214
215
216 sources = \
217         limitsMEMBERS.cc \
218         cmath.cc \
219         complex.cc complexf.cc complexl.cc complex_io.cc \
220         stdexcept.cc \
221         c++io.cc ios.cc stdstreams.cc strstream.cc \
222         locale.cc localename.cc codecvt.cc \
223         locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
224
225 wstring_sources = \
226         wstring-inst.cc
227
228 VPATH += $(top_srcdir) $(top_srcdir)/src
229 VPATH += $(glibcpp_includedir) $(top_srcdir)/std
230 VPATH += $(top_srcdir)/@ctype_include_dir@
231
232
233 # Actual sources for the distro, but don't build these.
234 #EXTRA_sources = string-inst.cc 
235
236 libstdc___la_SOURCES = $(sources)
237
238 libinst_wstring_la_SOURCES = $(wstring_sources)
239
240 libstdc___la_LIBADD = \
241         ../math/libmath.la ../libio/libio.la \
242         ../libsupc++/libsupc++convenience.la \
243         @libinst_wstring_la@
244
245 libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
246
247 libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
248
249
250 # Make sure cshadow headers are built first.
251 if GLIBCPP_USE_CSHADOW
252 CSHADOW_H = $(top_builddir)/stamp-cshadow
253 else
254 CSHADOW_H =
255 endif
256
257 # Specify that all *.o's depend on this.
258 $(libstdc___la_OBJECTS): $(CSHADOW_H)
259
260 $(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \
261                                $(top_srcdir)/mkcshadow
262         $(top_srcdir)/mkinclosure \
263         "-I $(top_builddir)/../../gcc/include -I /usr/include -G fcntl.h unistd.h" | $(top_srcdir)/mkcshadow;
264         rm -f  $(top_builddir)/stamp-cshadow 
265         echo "done" > $(top_builddir)/stamp-cshadow 
266
267
268 # We cannot use the default rules to install headers since we cannot
269 # statically decide which headers to install.  So we have our own special
270 # installation routine here.
271 myincludep = $(DESTDIR)$(includedir)/g++-v3/
272
273 install: myinstallheaders
274
275 # NB: As libio_headers may be empty, need this to make sure bash doesn't
276 # choke on an empty for... loop by using libio_headers_install
277 myinstallheaders: $(headers:%=$(myincludep)%)
278         if test -z "$(MULTISUBDIR)"; then \
279         for i in $(std_headers); do \
280           echo "$(INSTALL_DATA) $(glibcpp_includedir)/std/$$i $(myincludep)"; \
281                 $(INSTALL_DATA) $(glibcpp_includedir)/std/$$i $(myincludep); \
282         done; \
283         for i in $(generated_headers); do \
284           echo "$(INSTALL_DATA) $$i $(myincludep)bits/"; \
285                 $(INSTALL_DATA) $$i $(myincludep)bits/; \
286         done; \
287         libio_headers_install='$(libio_headers)'; \
288         for i in $$libio_headers_install; do \
289           echo "$(INSTALL_DATA) $$i $(myincludep)"; \
290                 $(INSTALL_DATA) $$i $(myincludep); \
291         done; \
292         echo "$(INSTALL_DATA) $(cpu_headers) $(myincludep)bits/"; \
293         $(INSTALL_DATA) $(cpu_headers) $(myincludep)bits/; \
294         fi;
295
296 $(headers:%=$(myincludep)%): $(myincludep)%: %
297         if test -z "$(MULTISUBDIR)"; then \
298         $(mkinstalldirs) $(@D); \
299         echo " $(INSTALL_DATA) $^ $@"; \
300         $(INSTALL_DATA) $^ $@; \
301         fi;
302
303 # All the (now removed) machinations with string instantiations messes up the
304 # automake-generated TAGS rule. Make a simple one here.
305 TAGS: $(generated_headers) $(cpu_headers) 
306         etags -C $(top_srcdir)/bits/*.h $(top_srcdir)/bits/*.tcc \
307         $(generated_headers) $(cpu_headers) $(libio_headers) \
308         $(top_srcdir)/src/*.cc \
309         $(top_builddir)/src/limitsMEMBERS.cc $(top_builddir)/src/c++io.cc \
310         -o $(top_builddir)/TAGS
311
312 # We have to handle misc-inst.cc and locale-inst.cc in a special way
313 # since we cannot instantiate all classes due to missing definitions
314 # for things like vptrs, type_info bits, etc. when using
315 # -fno-implicit-templates.
316 misc-inst.o: misc-inst.cc
317         $(CXXCOMPILE) -fimplicit-templates -c $<
318 misc-inst.lo: misc-inst.cc
319         $(LTCXXCOMPILE) -fimplicit-templates -c $<
320 locale-inst.o: locale-inst.cc
321         $(CXXCOMPILE) -fimplicit-templates -c $<
322 locale-inst.lo: locale-inst.cc
323         $(LTCXXCOMPILE) -fimplicit-templates -c $<
324
325 # We have to instantiate wstring bits too. . . 
326 wstring-inst.o: string-inst.cc
327         $(CXXCOMPILE) -fimplicit-templates -c -DC=wchar_t $< -o $@
328 wstring-inst.lo: string-inst.cc
329         $(LTCXXCOMPILE) -fimplicit-templates -c -DC=wchar_t $< -o $@
330
331 all: libstdc++.INC
332 libstdc++.INC: Makefile
333         $(MAKE) \
334           top_builddir=`CDPATH=:. && cd $(top_builddir) && pwd` \
335           top_srcdir=`CDPATH=:. && cd $(top_srcdir) && pwd` \
336           tmp-$@
337         -rm -f $@
338         mv tmp-$@ $@
339
340 tmp-libstdc++.INC: Makefile
341         echo -I$(top_builddir) $(INCLUDES) > $@
342
343
344