OSDN Git Service

2000-10-11 Benjamin Kosnik <bkoz@purist.soma.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 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.38 2000/10/10 23:50:39 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
39 toolexeclib_LTLIBRARIES = libstdc++.la
40 EXTRA_LTLIBRARIES = libinst-string.la libinst-wstring.la
41
42
43 # Compile flags that should be constant throughout the build, both for
44 # SUBDIRS and for libstdc++-v3 in general.
45 OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
46
47 # These bits are all figured out from configure. Look in acinclude.m4
48 # or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
49 # NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
50 CONFIG_CXXFLAGS = \
51         @EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ 
52
53 # Warning flags to use.
54 WARN_CXXFLAGS = \
55         @WARN_FLAGS@ $(WERROR) @WFMT_FLAGS@
56
57 # Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
58 GLIBCPP_INCLUDE_DIR = @GLIBCPP_INCLUDE_DIR@
59 C_INCLUDE_DIR = @C_INCLUDE_DIR@
60 TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
61 LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
62 LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
63 LIBIO_INCLUDES = @LIBIO_INCLUDES@
64 CSHADOW_INCLUDES = @CSHADOW_INCLUDES@
65
66 INCLUDES = \
67         -D_GNU_SOURCE -D_ISOC99_SOURCE -nostdinc++ \
68         $(CSHADOW_INCLUDES) $(LIBSUPCXX_INCLUDES) -I$(GLIBCPP_INCLUDE_DIR) \
69         $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) -I$(top_builddir) \
70         $(TOPLEVEL_INCLUDES)    
71
72 base_headers = \
73         bits/cpp_type_traits.h bits/char_traits.h bits/codecvt.h \
74         bits/basic_string.h bits/std_string.h  bits/string.tcc \
75         bits/generic_shadow.h bits/std_utility.h \
76         bits/std_complex.h \
77         bits/valarray_array.h bits/valarray_array.tcc bits/valarray_meta.h \
78         bits/std_valarray.h bits/mask_array.h bits/slice.h bits/slice_array.h \
79         bits/gslice.h bits/gslice_array.h bits/indirect_array.h \
80         bits/exception_support.h \
81         bits/std_fstream.h bits/std_iomanip.h \
82         bits/ios_base.h bits/fpos.h bits/basic_ios.h bits/basic_ios.tcc \
83         bits/std_ios.h bits/std_iosfwd.h bits/std_iostream.h \
84         bits/std_istream.h bits/istream.tcc bits/std_locale.h \
85         bits/fstream.tcc bits/ostream.tcc bits/sbuf_iter.h bits/sstream.tcc \
86         bits/std_ostream.h bits/std_sstream.h bits/std_streambuf.h \
87         bits/streambuf.tcc bits/basic_file.h \
88         bits/locale_facets.h bits/locale_facets.tcc bits/localefwd.h \
89         bits/stl_pthread_alloc.h bits/pthread_allocimpl.h \
90         bits/stl_threads.h bits/stl_iterator_base.h \
91         backward/algo.h backward/algobase.h backward/alloc.h \
92         backward/bvector.h backward/defalloc.h backward/deque.h \
93         backward/function.h backward/hash_map.h backward/hash_set.h \
94         backward/hashtable.h backward/heap.h backward/iterator.h \
95         backward/list.h backward/map.h backward/multimap.h backward/new.h \
96         backward/multiset.h backward/pair.h backward/iostream.h \
97         backward/rope.h backward/set.h backward/slist.h backward/stack.h \
98         backward/tempbuf.h backward/tree.h backward/vector.h \
99         backward/fstream.h \
100         bits/std_bitset.h bits/std_deque.h bits/std_functional.h \
101         bits/std_iterator.h bits/std_list.h \
102         bits/std_map.h bits/std_memory.h bits/std_numeric.h \
103         bits/std_queue.h bits/std_set.h bits/std_stack.h \
104         bits/std_stdexcept.h bits/std_vector.h \
105         bits/stl_algo.h bits/stl_algobase.h bits/stl_alloc.h \
106         bits/stl_deque.h bits/stl_function.h \
107         bits/stl_heap.h bits/stl_iterator.h bits/stl_list.h bits/stl_map.h \
108         bits/stl_multimap.h bits/stl_multiset.h bits/stl_numeric.h \
109         bits/stl_pair.h bits/stl_queue.h bits/stl_raw_storage_iter.h \
110         bits/stl_relops.h bits/stl_set.h \
111         bits/stl_stack.h bits/stl_string_fwd.h bits/stl_tempbuf.h \
112         bits/stl_tree.h bits/stl_uninitialized.h bits/stl_vector.h \
113         bits/type_traits.h bits/stl_range_errors.h bits/std_algorithm.h \
114         bits/concept_checks.h bits/container_concepts.h \
115         bits/sequence_concepts.h bits/std_strstream.h \
116         ext/ropeimpl.h ext/stl_rope.h \
117         ext/stl_bvector.h bits/stl_config.h bits/stl_construct.h \
118         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 
129
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         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         sys/cdefs.h 
137
138 if GLIBCPP_USE_CSHADOW
139 c_headers = $(c_base_headers) $(c_shadow_headers)
140 else
141 c_headers = $(c_base_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 strstream 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         $(top_builddir)/bits/std_limits.h $(top_builddir)/bits/c++config.h \
162         $(top_builddir)/bits/c++io.h $(top_builddir)/bits/c++threads.h \
163         $(top_builddir)/bits/atomicity.h $(top_builddir)/bits/os_defines.h \
164         $(top_builddir)/bits/ctype_base.h \
165         $(top_builddir)/bits/ctype_noninline.h \
166         $(top_builddir)/bits/ctype_inline.h 
167
168 headers = $(base_headers) $(c_headers)
169
170 sources = \
171         limitsMEMBERS.cc \
172         cmath.cc \
173         complex.cc complexf.cc complexl.cc complex_io.cc \
174         stdexcept.cc \
175         c++io.cc ios.cc stdstreams.cc strstream.cc \
176         locale.cc localename.cc codecvt.cc \
177         locale-inst.cc stl-inst.cc misc-inst.cc valarray-inst.cc string-inst.cc
178
179 wstring_sources = \
180         wstring-inst.cc
181
182 VPATH += $(top_srcdir) $(top_srcdir)/src
183 VPATH += $(GLIBCPP_INCLUDE_DIR) 
184 VPATH += $(GLIBCPP_INCLUDE_DIR)/std $(C_INCLUDE_DIR)
185
186 # Actual sources for the distro, but don't build these.
187 #EXTRA_sources = string-inst.cc 
188
189 libstdc___la_SOURCES = $(sources)
190
191 libinst_wstring_la_SOURCES = $(wstring_sources)
192
193 libstdc___la_LIBADD = \
194         ../libmath/libmath.la ../libio/libio.la \
195         ../libsupc++/libsupc++convenience.la \
196         @libinst_wstring_la@
197
198 libstdc___la_LDFLAGS = -version-info 3:0:0 -lm
199
200 libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD)
201
202
203 # Make sure cshadow headers are built first.
204 if GLIBCPP_USE_CSHADOW
205 CSHADOW_H = $(top_builddir)/stamp-cshadow
206 else
207 CSHADOW_H =
208 endif
209
210 # Specify that all *.o's depend on this.
211 $(libstdc___la_OBJECTS): $(CSHADOW_H)
212
213 $(top_builddir)/stamp-cshadow: $(top_srcdir)/mkinclosure \
214                                $(top_srcdir)/mkcshadow
215         $(top_srcdir)/mkinclosure \
216         "-I $(top_builddir)/../../gcc/include -I /usr/include -G fcntl.h unistd.h" | $(top_srcdir)/mkcshadow;
217         rm -f  $(top_builddir)/stamp-cshadow 
218         echo "done" > $(top_builddir)/stamp-cshadow 
219
220
221 # We cannot use the default rules to install headers since we cannot
222 # statically decide which headers to install.  So we have our own special
223 # installation routine here.
224 myincludep = $(DESTDIR)$(includedir)/g++-v3/
225
226 install: myinstallheaders
227
228 # NB: As libio_headers may be empty, need this to make sure bash doesn't
229 # choke on an empty for... loop by using libio_headers_install
230 myinstallheaders: $(headers:%=$(myincludep)%)
231         if test -z "$(MULTISUBDIR)"; then \
232         for i in $(std_headers); do \
233           echo "$(INSTALL_DATA) $(GLIBCPP_INCLUDE_DIR)/std/$$i $(myincludep)";\
234                 $(INSTALL_DATA) $(GLIBCPP_INCLUDE_DIR)/std/$$i $(myincludep); \
235         done; \
236         for i in $(build_headers); do \
237           echo "$(INSTALL_DATA) $$i $(myincludep)bits/"; \
238                 $(INSTALL_DATA) $$i $(myincludep)bits/; \
239         done; \
240         libio_headers_install='$(libio_headers)'; \
241         for i in $$libio_headers_install; do \
242           echo "$(INSTALL_DATA) $$i $(myincludep)"; \
243                 $(INSTALL_DATA) $$i $(myincludep); \
244         done; \
245         fi;
246
247 $(headers:%=$(myincludep)%): $(myincludep)%: %
248         if test -z "$(MULTISUBDIR)"; then \
249         $(mkinstalldirs) $(@D); \
250         echo " $(INSTALL_DATA) $^ $@"; \
251         $(INSTALL_DATA) $^ $@; \
252         fi;
253
254 # All the (now removed) machinations with string instantiations messes up the
255 # automake-generated TAGS rule. Make a simple one here.
256 TAGS: $(build_headers) $(cpu_headers) 
257         etags -C $(top_srcdir)/bits/*.h $(top_srcdir)/bits/*.tcc \
258         $(build_headers) $(libio_headers) \
259         $(top_srcdir)/src/*.cc \
260         $(top_builddir)/src/limitsMEMBERS.cc $(top_builddir)/src/c++io.cc \
261         -o $(top_builddir)/TAGS
262
263 # We have to handle misc-inst.cc and locale-inst.cc in a special way
264 # since we cannot instantiate all classes due to missing definitions
265 # for things like vptrs, type_info bits, etc. when using
266 # -fno-implicit-templates.
267 misc-inst.o: misc-inst.cc
268         $(CXXCOMPILE) -fimplicit-templates -c $<
269 misc-inst.lo: misc-inst.cc
270         $(LTCXXCOMPILE) -fimplicit-templates -c $<
271 locale-inst.o: locale-inst.cc
272         $(CXXCOMPILE) -fimplicit-templates -c $<
273 locale-inst.lo: locale-inst.cc
274         $(LTCXXCOMPILE) -fimplicit-templates -c $<
275
276 # We have to instantiate wstring bits too. . . 
277 wstring-inst.o: string-inst.cc
278         $(CXXCOMPILE) -fimplicit-templates -c -DC=wchar_t $< -o $@
279 wstring-inst.lo: string-inst.cc
280         $(LTCXXCOMPILE) -fimplicit-templates -c -DC=wchar_t $< -o $@
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 -I$(top_builddir) $(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.
299 # Need to manually set this option because CONFIG_CXXFLAGS has to be at
300 # the end of the compile line so that -O2 can be overridden as the
301 # occasion call for it. (ie, --enable-debug)
302 AM_CXXFLAGS = \
303         -fno-implicit-templates \
304         $(WARN_CXXFLAGS) \
305         $(OPTIMIZE_CXXFLAGS) \
306         $(CONFIG_CXXFLAGS) 
307
308 # Need to explicitly set this so that AM_CXXFLAGS is last. In
309 # addition, we don't use $(DEFS), which tries to set $(top_srcdir) as
310 # an include diretory, which screws up shadow headers. (That way,
311 # things like -O2 passed down from the toplevel can be overridden by
312 # --enable-debug.)
313 CXXCOMPILE = $(CXX) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
314              $(CXXFLAGS) $(AM_CXXFLAGS) 
315
316 LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(INCLUDES) \
317                $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
318
319 # We have a problem when building the shared libstdc++ object if the
320 # rules automake generates would be used.  We cannot allow CXX to be used
321 # in libtool since this would add -lstdc++ to the link line which of
322 # course is impossible.
323 CXXLINK = $(LIBTOOL) --mode=link "$(CC)" @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
324
325
326
327
328
329
330
331
332
333