Makefile.am revision 117397
1## Makefile for the src subdirectory of the GNU C++ Standard library.
2##
3## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
4## Free Software Foundation, Inc.
5##
6## This file is part of the libstdc++ version 3 distribution.
7## Process this file with automake to produce Makefile.in.
8
9## This file is part of the GNU ISO C++ Library.  This library is free
10## software; you can redistribute it and/or modify it under the
11## terms of the GNU General Public License as published by the
12## Free Software Foundation; either version 2, or (at your option)
13## any later version.
14
15## This library is distributed in the hope that it will be useful,
16## but WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18## GNU General Public License for more details.
19
20## You should have received a copy of the GNU General Public License along
21## with this library; see the file COPYING.  If not, write to the Free
22## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23## USA.
24
25AUTOMAKE_OPTIONS = 1.3 cygnus
26MAINT_CHARSET = latin1
27
28mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
29
30# Cross compiler support.
31CXX = @glibcpp_CXX@
32glibcpp_srcdir=@glibcpp_srcdir@
33glibcpp_builddir=@glibcpp_builddir@
34toolexecdir = @glibcpp_toolexecdir@
35toolexeclibdir = @glibcpp_toolexeclibdir@
36toolexeclib_LTLIBRARIES = libstdc++.la
37
38# Symbol versioning for shared libraries.
39if GLIBCPP_BUILD_VERSIONED_SHLIB
40version_arg = -Wl,--version-script=libstdc++-symbol.ver
41libstdc++-symbol.ver:  ${glibcpp_srcdir}/@SYMVER_MAP@
42	@LN_S@  ${glibcpp_srcdir}/@SYMVER_MAP@ ./libstdc++-symbol.ver || true
43else
44version_arg =
45libstdc++-symbol.ver:
46endif
47
48# Compile flags that should be constant throughout the build, both for
49# SUBDIRS and for libstdc++-v3 in general.
50OPTIMIZE_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
54CONFIG_CXXFLAGS = \
55	@SECTION_FLAGS@ @EXTRA_CXX_FLAGS@ 
56
57# Warning flags to use.
58WARN_CXXFLAGS = \
59	@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
60
61# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
62GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
63LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
64LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
65LIBIO_INCLUDES = @LIBIO_INCLUDES@
66TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
67
68INCLUDES = \
69	-nostdinc++ \
70	$(GLIBCPP_INCLUDES) \
71	$(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
72	$(TOPLEVEL_INCLUDES)
73
74# Source files linked in via configuration/make substitution for a
75# particular target.
76target_sources = \
77	codecvt_members.cc \
78	collate_members.cc \
79	ctype_members.cc \
80	messages_members.cc \
81	monetary_members.cc \
82	numeric_members.cc \
83	time_members.cc
84
85codecvt_members.cc: ${glibcpp_srcdir}/@CCODECVT_CC@
86	@LN_S@ ${glibcpp_srcdir}/@CCODECVT_CC@ . || true
87
88collate_members.cc: ${glibcpp_srcdir}/@CCOLLATE_CC@
89	@LN_S@ ${glibcpp_srcdir}/@CCOLLATE_CC@ . || true
90
91ctype_members.cc: ${glibcpp_srcdir}/@CCTYPE_CC@
92	@LN_S@ ${glibcpp_srcdir}/@CCTYPE_CC@ . || true
93
94messages_members.cc: ${glibcpp_srcdir}/@CMESSAGES_CC@
95	@LN_S@ ${glibcpp_srcdir}/@CMESSAGES_CC@ . || true
96
97monetary_members.cc: ${glibcpp_srcdir}/@CMONEY_CC@
98	@LN_S@ ${glibcpp_srcdir}/@CMONEY_CC@ . || true
99
100numeric_members.cc: ${glibcpp_srcdir}/@CNUMERIC_CC@
101	@LN_S@ ${glibcpp_srcdir}/@CNUMERIC_CC@ . || true
102
103time_members.cc: ${glibcpp_srcdir}/@CTIME_CC@
104	@LN_S@ ${glibcpp_srcdir}/@CTIME_CC@ . || true
105
106# Source files linked in via configuration/make substitution for a
107# particular target, but with ad hoc naming rules.
108target_sources_extra = \
109	basic_file.cc \
110	c++locale.cc 
111
112c++locale.cc: ${glibcpp_srcdir}/@CLOCALE_CC@
113	@LN_S@ ${glibcpp_srcdir}/@CLOCALE_CC@ ./$@ || true
114
115basic_file.cc: ${glibcpp_srcdir}/@BASIC_FILE_CC@
116	@LN_S@ ${glibcpp_srcdir}/@BASIC_FILE_CC@ ./$@ || true
117
118# Sources present in the src directory.
119sources = \
120	bitset.cc \
121	codecvt.cc \
122	complex_io.cc \
123	concept-inst.cc \
124	ctype.cc \
125	ext-inst.cc \
126	fstream.cc \
127	fstream-inst.cc \
128	functexcept.cc \
129	globals.cc \
130	io-inst.cc \
131	ios.cc \
132	istream-inst.cc \
133	limits.cc \
134	locale.cc \
135	locale-inst.cc \
136	localename.cc \
137	misc-inst.cc \
138	ostream-inst.cc \
139	sstream-inst.cc \
140	stdexcept.cc \
141	stl-inst.cc \
142	streambuf-inst.cc \
143	string-inst.cc \
144	strstream.cc \
145	valarray-inst.cc \
146	vterminate.cc \
147	wstring-inst.cc \
148	${target_sources} \
149	${target_sources_extra}
150
151VPATH = $(top_srcdir)/src:$(top_srcdir)
152
153libstdc___la_SOURCES = $(sources)
154
155libstdc___la_LIBADD = \
156	$(top_builddir)/libmath/libmath.la @libio_la@ \
157	$(top_builddir)/libsupc++/libsupc++convenience.la
158
159libstdc___la_DEPENDENCIES = libstdc++-symbol.ver $(libstdc___la_LIBADD)
160
161libstdc___la_LDFLAGS = \
162	-version-info @libtool_VERSION@ ${version_arg} \
163	-lm @LIBUNWIND_FLAG@ 
164
165
166# Use special rules for the deprecated source files so that they find
167# deprecated include files.
168GLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
169strstream.lo: strstream.cc
170	$(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
171strstream.o: strstream.cc
172	$(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
173
174# Use special rules for the concept-checking instantiations so that all
175# the generated template functions are also instantiated.  Force the checks
176# to be on so that the instantiations are actually seen.
177concept-inst.lo: concept-inst.cc
178	$(LTCXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
179concept-inst.o: concept-inst.cc
180	$(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
181
182
183# AM_CXXFLAGS needs to be in each subdirectory so that it can be
184# modified in a per-library or per-sub-library way.  Need to manually
185# set this option because CONFIG_CXXFLAGS has to be after
186# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
187# as the occasion call for it. 
188AM_CXXFLAGS = \
189	-fno-implicit-templates \
190	$(LIBSUPCXX_CXXFLAGS) \
191	$(WARN_CXXFLAGS) \
192	$(OPTIMIZE_CXXFLAGS) \
193	$(CONFIG_CXXFLAGS)  
194
195
196# libstdc++ libtool notes
197
198# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
199# last. (That way, things like -O2 passed down from the toplevel can
200# be overridden by --enable-debug.)
201
202# 2) In general, libtool expects an argument such as `--tag=CXX' when
203# using the C++ compiler, because that will enable the settings
204# detected when C++ support was being configured.  However, when no
205# such flag is given in the command line, libtool attempts to figure
206# it out by matching the compiler name in each configuration section
207# against a prefix of the command line.  The problem is that, if the
208# compiler name and its initial flags stored in the libtool
209# configuration file don't match those in the command line, libtool
210# can't decide which configuration to use, and it gives up.  The
211# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
212# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
213# attempt to infer which configuration to use
214LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
215	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
216
217# 3) We'd have a problem when building the shared libstdc++ object if
218# the rules automake generates would be used.  We cannot allow g++ to
219# be used since this would add -lstdc++ to the link line which of
220# course is problematic at this point.  So, we get the top-level
221# directory to configure libstdc++-v3 to use gcc as the C++
222# compilation driver.
223CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
224	  @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
225
226
227# Added bits to build debug library.
228if GLIBCPP_BUILD_DEBUG
229all-local: build_debug
230install-data-local: install_debug
231else
232all-local:
233install-data-local: 
234endif
235
236debugdir = debug
237
238# Build parallel set of debug objects here.
239stamp-debug: 
240	if test ! -d ${debugdir}; then \
241	  mkdir -p ${debugdir}; \
242	  (cd ${debugdir}; \
243	  sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \
244	      -e 's/srcdir = \.\./srcdir = ..\/../' \
245	      -e 's/glibcpp_basedir = \.\./glibcpp_basedir = ..\/../' \
246	      -e 's/all-local: build_debug/all-local:/' \
247	      -e 's/install-data-local: install_debug/install-data-local:/' \
248	  < ../Makefile > Makefile) ; \
249	fi; \
250	echo `date` > stamp-debug; 
251
252build_debug: stamp-debug
253	(cd ${debugdir} && $(MAKE) CXXFLAGS='@DEBUG_FLAGS@' all)
254
255# Install debug library here.
256install_debug: 
257	(cd ${debugdir} && $(MAKE) \
258	toolexeclibdir=@glibcpp_toolexeclibdir@/debug install)
259