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