Makefile.am revision 103447
1## Makefile for the src subdirectory of the GNU C++ Standard library.
2##
3## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
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@
32toolexecdir = @glibcpp_toolexecdir@
33toolexeclibdir = @glibcpp_toolexeclibdir@
34toolexeclib_LTLIBRARIES = libstdc++.la
35
36# Compile flags that should be constant throughout the build, both for
37# SUBDIRS and for libstdc++-v3 in general.
38OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
39
40# These bits are all figured out from configure. Look in acinclude.m4
41# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
42# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
43CONFIG_CXXFLAGS = \
44	@EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @DEBUG_FLAGS@ 
45
46# Warning flags to use.
47WARN_CXXFLAGS = \
48	@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
49
50# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
51GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
52LIBMATH_INCLUDES = @LIBMATH_INCLUDES@
53LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
54LIBIO_INCLUDES = @LIBIO_INCLUDES@
55TOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
56
57INCLUDES = \
58	-nostdinc++ \
59	$(GLIBCPP_INCLUDES) \
60	$(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
61	$(TOPLEVEL_INCLUDES)
62
63# Source files linked in via configuration magic for a particular target.
64target_sources = \
65	codecvt_members.cc \
66	collate_members.cc \
67	ctype_members.cc \
68	messages_members.cc \
69	monetary_members.cc \
70	numeric_members.cc \
71	time_members.cc
72
73# Source files linked in via configuration magic for a particular
74# target, but with ad hoc naming rules.
75target_sources_extra = \
76	basic_file.cc \
77	c++locale.cc 
78
79# Sources present in the src directory.
80sources = \
81	bitset.cc \
82	codecvt.cc \
83	complex_io.cc \
84	concept-inst.cc \
85	ctype.cc \
86	ext-inst.cc \
87	fstream.cc \
88	fstream-inst.cc \
89	functexcept.cc \
90	globals.cc \
91	io-inst.cc \
92	ios.cc \
93	istream-inst.cc \
94	limits.cc \
95	locale.cc \
96	locale-inst.cc \
97	localename.cc \
98	misc-inst.cc \
99	ostream-inst.cc \
100	sstream-inst.cc \
101	stdexcept.cc \
102	stl-inst.cc \
103	streambuf-inst.cc \
104	string-inst.cc \
105	strstream.cc \
106	valarray-inst.cc \
107	vterminate.cc \
108	wstring-inst.cc \
109	${target_sources} \
110	${target_sources_extra}
111
112VPATH = $(top_srcdir)/src:$(top_srcdir)
113
114libstdc___la_SOURCES = $(sources)
115
116libstdc___la_LIBADD = \
117	../libmath/libmath.la @libio_la@ \
118	../libsupc++/libsupc++convenience.la
119
120if GLIBCPP_BUILD_VERSIONED_SHLIB
121version_arg=-Wl,--version-script=linker.map
122else
123version_arg=
124endif
125
126libstdc___la_LDFLAGS = \
127	-version-info @libtool_VERSION@ ${version_arg} \
128	-lm @LIBUNWIND_FLAG@ 
129
130libstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) linker.map
131
132# Use special rules for the deprecated source files so that they find
133# deprecated include files.
134GLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
135strstream.lo: strstream.cc
136	$(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
137strstream.o: strstream.cc
138	$(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
139
140# Use special rules for the concept-checking instantiations so that all
141# the generated template functions are also instantiated.  Force the checks
142# to be on so that the instantiations are actually seen.
143concept-inst.lo: concept-inst.cc
144	$(LTCXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
145concept-inst.o: concept-inst.cc
146	$(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
147
148
149# AM_CXXFLAGS needs to be in each subdirectory so that it can be
150# modified in a per-library or per-sub-library way.  Need to manually
151# set this option because CONFIG_CXXFLAGS has to be after
152# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
153# as the occasion call for it. (ie, --enable-debug)
154AM_CXXFLAGS = \
155	-fno-implicit-templates \
156	$(LIBSUPCXX_CXXFLAGS) \
157	$(WARN_CXXFLAGS) \
158	$(OPTIMIZE_CXXFLAGS) \
159	$(CONFIG_CXXFLAGS) 
160
161
162# libstdc++ libtool notes
163
164# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
165# last. (That way, things like -O2 passed down from the toplevel can
166# be overridden by --enable-debug.)
167
168# 2) In general, libtool expects an argument such as `--tag=CXX' when
169# using the C++ compiler, because that will enable the settings
170# detected when C++ support was being configured.  However, when no
171# such flag is given in the command line, libtool attempts to figure
172# it out by matching the compiler name in each configuration section
173# against a prefix of the command line.  The problem is that, if the
174# compiler name and its initial flags stored in the libtool
175# configuration file don't match those in the command line, libtool
176# can't decide which configuration to use, and it gives up.  The
177# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
178# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
179# attempt to infer which configuration to use
180LTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
181	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
182
183# 3) We'd have a problem when building the shared libstdc++ object if
184# the rules automake generates would be used.  We cannot allow g++ to
185# be used since this would add -lstdc++ to the link line which of
186# course is problematic at this point.  So, we get the top-level
187# directory to configure libstdc++-v3 to use gcc as the C++
188# compilation driver.
189CXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
190	  @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
191