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