197403Sobrien## Makefile for the GNU C++ Support library.
297403Sobrien##
3169691Skan## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
4169691Skan## Free Software Foundation, Inc.
597403Sobrien##
697403Sobrien## Process this file with automake to produce Makefile.in.
797403Sobrien##
8132720Skan## This file is part of GCC.
997403Sobrien##
10132720Skan## GCC is free software; you can redistribute it and/or modify
1197403Sobrien## it under the terms of the GNU General Public License as published by
1297403Sobrien## the Free Software Foundation; either version 2, or (at your option)
1397403Sobrien## any later version.
1497403Sobrien##
15132720Skan## GCC 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
21132720Skan## along with GCC; see the file COPYING.  If not, write to
22169691Skan## the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23169691Skan## Boston, MA 02110-1301, USA.
2497403Sobrien
25132720Skaninclude $(top_srcdir)/fragment.am
2697403Sobrien
2797403Sobrien# Need this library to both be part of libstdc++.a, and installed
2897403Sobrien# separately too.
29132720Skan# 1) separate libsupc++.la
3097403Sobrientoolexeclib_LTLIBRARIES = libsupc++.la
3197403Sobrien# 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a
3297403Sobriennoinst_LTLIBRARIES = libsupc++convenience.la
3397403Sobrien
3497403Sobrien
3597403Sobrienheaders = \
36132720Skan	exception new typeinfo cxxabi.h exception_defines.h
3797403Sobrien
38169691Skanif GLIBCXX_HOSTED
39169691Skan  c_sources = \
40132720Skan	cp-demangle.c 
41169691Skanendif
42102782Skan
4397403Sobriensources = \
4497403Sobrien	del_op.cc \
4597403Sobrien	del_opnt.cc \
4697403Sobrien	del_opv.cc \
4797403Sobrien	del_opvnt.cc \
4897403Sobrien	eh_alloc.cc \
49169691Skan	eh_arm.cc \
5097403Sobrien	eh_aux_runtime.cc \
51169691Skan	eh_call.cc \
5297403Sobrien	eh_catch.cc \
5397403Sobrien	eh_exception.cc \
5497403Sobrien	eh_globals.cc \
5597403Sobrien	eh_personality.cc \
56132720Skan	eh_term_handler.cc \
5797403Sobrien	eh_terminate.cc \
5897403Sobrien	eh_throw.cc \
5997403Sobrien	eh_type.cc \
60132720Skan	eh_unex_handler.cc \
61117397Skan	guard.cc \
6297403Sobrien	new_handler.cc \
6397403Sobrien	new_op.cc \
6497403Sobrien	new_opnt.cc \
6597403Sobrien	new_opv.cc \
6697403Sobrien	new_opvnt.cc \
6797403Sobrien	pure.cc \
6897403Sobrien	tinfo.cc \
6997403Sobrien	tinfo2.cc \
70132720Skan	vec.cc \
71132720Skan	vterminate.cc
7297403Sobrien
73102782Skanlibsupc___la_SOURCES = $(sources) $(c_sources)
74102782Skanlibsupc__convenience_la_SOURCES = $(sources) $(c_sources)
7597403Sobrien
76132720Skanglibcxxinstalldir = $(gxx_include_dir)
77132720Skanglibcxxinstall_HEADERS = $(headers)
7897403Sobrien
79132720Skan# AM_CXXFLAGS needs to be in each subdirectory so that it can be
80132720Skan# modified in a per-library or per-sub-library way.  Need to manually
81132720Skan# set this option because CONFIG_CXXFLAGS has to be after
82132720Skan# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
83132720Skan# as the occasion call for it.
84132720SkanAM_CXXFLAGS = \
85132720Skan	-fno-implicit-templates \
86132720Skan	$(LIBSUPCXX_PICFLAGS) \
87132720Skan	$(WARN_CXXFLAGS) \
88132720Skan	$(OPTIMIZE_CXXFLAGS) \
89132720Skan	$(CONFIG_CXXFLAGS)
9097403Sobrien
91132720SkanAM_MAKEFLAGS = \
92132720Skan	"gxx_include_dir=$(gxx_include_dir)"
93132720Skan
94132720Skan
95102782Skan# Use special rules for pulling things out of libiberty.  These
96102782Skan# objects should be compiled with the "C" compiler, not the C++
97102782Skan# compiler, and also should not use the C++ includes.
98132720SkanC_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
99102782SkanC_COMPILE = \
100132720Skan	$(CC) $(DEFS) $(C_INCLUDES) \
101102782Skan	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
102102782Skan
103132720Skan# LTCOMPILE is copied from LTCXXCOMPILE below.
104132720SkanLTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared --mode=compile $(CC) \
105132720Skan	    $(DEFS) $(C_INCLUDES) $(LIBSUPCXX_PICFLAGS) \
106132720Skan            $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
107132720Skan
108132720Skancp-demangle.c:
10997403Sobrien	rm -f $@
11097403Sobrien	$(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
111132720Skancp-demangle.lo: cp-demangle.c
11297403Sobrien	$(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
113132720Skancp-demangle.o: cp-demangle.c
114102782Skan	$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
11597403Sobrien
11697403Sobrien
11797403Sobrien# libstdc++ libtool notes
11897403Sobrien
11997403Sobrien# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
12097403Sobrien# last. (That way, things like -O2 passed down from the toplevel can
12197403Sobrien# be overridden by --enable-debug.)
12297403Sobrien
12397403Sobrien# 2) In general, libtool expects an argument such as `--tag=CXX' when
12497403Sobrien# using the C++ compiler, because that will enable the settings
12597403Sobrien# detected when C++ support was being configured.  However, when no
12697403Sobrien# such flag is given in the command line, libtool attempts to figure
12797403Sobrien# it out by matching the compiler name in each configuration section
12897403Sobrien# against a prefix of the command line.  The problem is that, if the
12997403Sobrien# compiler name and its initial flags stored in the libtool
13097403Sobrien# configuration file don't match those in the command line, libtool
13197403Sobrien# can't decide which configuration to use, and it gives up.  The
13297403Sobrien# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
13397403Sobrien# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
13497403Sobrien# attempt to infer which configuration to use.
13597403Sobrien#
13697403Sobrien# We have to put --tag disable-shared after --tag CXX lest things
13797403Sobrien# CXX undo the affect of disable-shared.
13897403SobrienLTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
139132720Skan	       --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
140169691Skan	       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 
14197403Sobrien
142169691SkanLTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
143169691Skan
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 --tag disable-shared \
151132720Skan	  --mode=link $(CXX) \
152169691Skan	  $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
15397403Sobrien
15497403Sobrien# We have to have rules modified from the default to counteract SUN make
155132720Skan# prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
156132720Skaninstall-glibcxxinstallHEADERS: $(glibcxxinstall_HEADERS)
15797403Sobrien	@$(NORMAL_INSTALL)
158132720Skan	$(mkinstalldirs) $(DESTDIR)$(glibcxxinstalldir)
159132720Skan	@list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
16097403Sobrien	  q=`echo $$p | sed -e 's,.*/,,'`; \
16197403Sobrien	  if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
162132720Skan	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q"; \
163132720Skan	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q; \
16497403Sobrien	done
16597403Sobrien
166132720Skanuninstall-glibcxxinstallHEADERS:
16797403Sobrien	@$(NORMAL_UNINSTALL)
168132720Skan	list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
16997403Sobrien	  q=`echo $$p | sed -e 's,.*/,,'`; \
170132720Skan	  rm -f $(DESTDIR)$(glibcxxinstalldir)/$$q; \
17197403Sobrien	done
172