Makefile.am revision 97403
197403Sobrien## Makefile for the src subdirectory of the GNU C++ Standard library.
297403Sobrien##
397403Sobrien## Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
497403Sobrien## Free Software Foundation, Inc.
597403Sobrien##
697403Sobrien## This file is part of the libstdc++ version 3 distribution.
797403Sobrien## Process this file with automake to produce Makefile.in.
897403Sobrien
997403Sobrien## This file is part of the GNU ISO C++ Library.  This library is free
1097403Sobrien## software; you can redistribute it and/or modify it under the
1197403Sobrien## terms of the GNU General Public License as published by the
1297403Sobrien## Free Software Foundation; either version 2, or (at your option)
1397403Sobrien## any later version.
1497403Sobrien
1597403Sobrien## This library is distributed in the hope that it will be useful,
1697403Sobrien## but WITHOUT ANY WARRANTY; without even the implied warranty of
1797403Sobrien## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1897403Sobrien## GNU General Public License for more details.
1997403Sobrien
2097403Sobrien## You should have received a copy of the GNU General Public License along
2197403Sobrien## with this library; see the file COPYING.  If not, write to the Free
2297403Sobrien## Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
2397403Sobrien## USA.
2497403Sobrien
2597403SobrienAUTOMAKE_OPTIONS = 1.3 gnits
2697403SobrienMAINT_CHARSET = latin1
2797403Sobrien
2897403Sobrienmkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
2997403Sobrien
3097403Sobrien# Cross compiler and multilib support.
3197403SobrienCXX = @glibcpp_CXX@
3297403Sobrientoolexecdir = @glibcpp_toolexecdir@
3397403Sobrientoolexeclibdir = @glibcpp_toolexeclibdir@
3497403Sobrientoolexeclib_LTLIBRARIES = libstdc++.la
3597403Sobrien
3697403Sobrien# Compile flags that should be constant throughout the build, both for
3797403Sobrien# SUBDIRS and for libstdc++-v3 in general.
3897403SobrienOPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
3997403Sobrien
4097403Sobrien# These bits are all figured out from configure. Look in acinclude.m4
4197403Sobrien# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
4297403Sobrien# NB: DEBUGFLAGS have to be at the end so that -O2 can be overridden.
4397403SobrienCONFIG_CXXFLAGS = \
4497403Sobrien	@EXTRA_CXX_FLAGS@ @SECTION_FLAGS@ @CSHADOW_FLAGS@ @DEBUG_FLAGS@ 
4597403Sobrien
4697403Sobrien# Warning flags to use.
4797403SobrienWARN_CXXFLAGS = \
4897403Sobrien	@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
4997403Sobrien
5097403Sobrien# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
5197403SobrienGLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
5297403SobrienLIBMATH_INCLUDES = @LIBMATH_INCLUDES@
5397403SobrienLIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
5497403SobrienLIBIO_INCLUDES = @LIBIO_INCLUDES@
5597403SobrienTOPLEVEL_INCLUDES = @TOPLEVEL_INCLUDES@
5697403Sobrien
5797403SobrienINCLUDES = \
5897403Sobrien	-nostdinc++ \
5997403Sobrien	$(GLIBCPP_INCLUDES) \
6097403Sobrien	$(LIBSUPCXX_INCLUDES) $(LIBIO_INCLUDES) $(LIBMATH_INCLUDES) \
6197403Sobrien	$(TOPLEVEL_INCLUDES)
6297403Sobrien
6397403Sobriensources = \
6497403Sobrien	globals.cc limits.cc \
6597403Sobrien	basic_file.cc complex_io.cc ios.cc strstream.cc \
6697403Sobrien	cmath.cc bitset.cc \
6797403Sobrien	functexcept.cc stdexcept.cc vterminate.cc \
6897403Sobrien	c++locale.cc locale.cc localename.cc codecvt.cc \
6997403Sobrien	collate.cc ctype.cc messages.cc monetary.cc numeric.cc time.cc \
7097403Sobrien	concept-inst.cc locale-inst.cc misc-inst.cc stl-inst.cc \
7197403Sobrien	string-inst.cc wstring-inst.cc valarray-inst.cc  ext-inst.cc
7297403Sobrien
7397403SobrienVPATH = $(top_srcdir)/src:$(top_srcdir)
7497403Sobrien
7597403Sobrienlibstdc___la_SOURCES = $(sources)
7697403Sobrien
7797403Sobrienlibstdc___la_LIBADD = \
7897403Sobrien	../libmath/libmath.la @libio_la@ \
7997403Sobrien	../libsupc++/libsupc++convenience.la
8097403Sobrien
8197403Sobrienif GLIBCPP_BUILD_VERSIONED_SHLIB
8297403Sobrienversion_arg=-Wl,--version-script=linker.map
8397403Sobrienelse
8497403Sobrienversion_arg=
8597403Sobrienendif
8697403Sobrien
8797403Sobrienlibstdc___la_LDFLAGS = \
8897403Sobrien	-version-info @libtool_VERSION@ ${version_arg} \
8997403Sobrien	-lm @LIBUNWIND_FLAG@ 
9097403Sobrien
9197403Sobrienlibstdc___la_DEPENDENCIES = $(libstdc___la_LIBADD) linker.map
9297403Sobrien
9397403Sobrien# Use special rules for the deprecated source files so that they find
9497403Sobrien# deprecated include files.
9597403SobrienGLIBCPP_INCLUDE_DIR=@glibcpp_builddir@/include
9697403Sobrienstrstream.lo: strstream.cc
9797403Sobrien	$(LTCXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
9897403Sobrienstrstream.o: strstream.cc
9997403Sobrien	$(CXXCOMPILE) -I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated -c $<
10097403Sobrien
10197403Sobrien# Use special rules for the concept-checking instantiations so that all
10297403Sobrien# the generated template functions are also instantiated.  Force the checks
10397403Sobrien# to be on so that the instantiations are actually seen.
10497403Sobrienconcept-inst.lo: concept-inst.cc
10597403Sobrien	$(LTCXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
10697403Sobrienconcept-inst.o: concept-inst.cc
10797403Sobrien	$(CXXCOMPILE) -D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates -c $<
10897403Sobrien
10997403Sobrien
11097403Sobrien# AM_CXXFLAGS needs to be in each subdirectory so that it can be
11197403Sobrien# modified in a per-library or per-sub-library way.  Need to manually
11297403Sobrien# set this option because CONFIG_CXXFLAGS has to be after
11397403Sobrien# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
11497403Sobrien# as the occasion call for it. (ie, --enable-debug)
11597403SobrienAM_CXXFLAGS = \
11697403Sobrien	-fno-implicit-templates \
11797403Sobrien	$(LIBSUPCXX_CXXFLAGS) \
11897403Sobrien	$(WARN_CXXFLAGS) \
11997403Sobrien	$(OPTIMIZE_CXXFLAGS) \
12097403Sobrien	$(CONFIG_CXXFLAGS) 
12197403Sobrien
12297403Sobrien
12397403Sobrien# libstdc++ libtool notes
12497403Sobrien
12597403Sobrien# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
12697403Sobrien# last. (That way, things like -O2 passed down from the toplevel can
12797403Sobrien# be overridden by --enable-debug.)
12897403Sobrien
12997403Sobrien# 2) In general, libtool expects an argument such as `--tag=CXX' when
13097403Sobrien# using the C++ compiler, because that will enable the settings
13197403Sobrien# detected when C++ support was being configured.  However, when no
13297403Sobrien# such flag is given in the command line, libtool attempts to figure
13397403Sobrien# it out by matching the compiler name in each configuration section
13497403Sobrien# against a prefix of the command line.  The problem is that, if the
13597403Sobrien# compiler name and its initial flags stored in the libtool
13697403Sobrien# configuration file don't match those in the command line, libtool
13797403Sobrien# can't decide which configuration to use, and it gives up.  The
13897403Sobrien# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
13997403Sobrien# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
14097403Sobrien# attempt to infer which configuration to use
14197403SobrienLTCXXCOMPILE = $(LIBTOOL) --tag CXX --mode=compile $(CXX) $(INCLUDES) \
14297403Sobrien	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) 
14397403Sobrien
14497403Sobrien# 3) We'd have a problem when building the shared libstdc++ object if
14597403Sobrien# the rules automake generates would be used.  We cannot allow g++ to
14697403Sobrien# be used since this would add -lstdc++ to the link line which of
14797403Sobrien# course is problematic at this point.  So, we get the top-level
14897403Sobrien# directory to configure libstdc++-v3 to use gcc as the C++
14997403Sobrien# compilation driver.
15097403SobrienCXXLINK = $(LIBTOOL) --tag CXX --mode=link $(CXX) \
15197403Sobrien	  @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
152