1157114Sscottl## Makefile for the GNU C++ Support library.
2157114Sscottl##
3157114Sscottl## Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4157114Sscottl##
5157114Sscottl## Process this file with automake to produce Makefile.in.
6157114Sscottl##
7157114Sscottl## This file is part of GCC.
8157114Sscottl##
9157114Sscottl## GCC is free software; you can redistribute it and/or modify
10157114Sscottl## it under the terms of the GNU General Public License as published by
11157114Sscottl## the Free Software Foundation; either version 2, or (at your option)
12157114Sscottl## any later version.
13157114Sscottl##
14157114Sscottl## GCC is distributed in the hope that it will be useful,
15157114Sscottl## but WITHOUT ANY WARRANTY; without even the implied warranty of
16157114Sscottl## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17157114Sscottl## GNU General Public License for more details.
18157114Sscottl##
19157114Sscottl## You should have received a copy of the GNU General Public License
20157114Sscottl## along with GCC; see the file COPYING.  If not, write to
21157114Sscottl## the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22157114Sscottl## Boston, MA 02110-1301, USA.
23157114Sscottl
24157114Sscottlinclude $(top_srcdir)/fragment.am
25157114Sscottl
26171980Sscottl# Need this library to both be part of libstdc++.a, and installed
27171980Sscottl# separately too.
28171980Sscottl# 1) separate libsupc++.la
29171980Sscottltoolexeclib_LTLIBRARIES = libsupc++.la
30171980Sscottl# 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a
31171980Sscottlnoinst_LTLIBRARIES = libsupc++convenience.la
32171980Sscottl
33171980Sscottl
34171980Sscottlheaders = \
35171980Sscottl	exception new typeinfo cxxabi.h exception_defines.h
36171980Sscottl
37171980Sscottlif GLIBCXX_HOSTED
38171980Sscottl  c_sources = \
39171980Sscottl	cp-demangle.c 
40171980Sscottlendif
41171980Sscottl
42171980Sscottlsources = \
43171980Sscottl	del_op.cc \
44171980Sscottl	del_opnt.cc \
45171980Sscottl	del_opv.cc \
46171980Sscottl	del_opvnt.cc \
47171980Sscottl	eh_alloc.cc \
48171980Sscottl	eh_arm.cc \
49171980Sscottl	eh_aux_runtime.cc \
50171980Sscottl	eh_call.cc \
51171980Sscottl	eh_catch.cc \
52157114Sscottl	eh_exception.cc \
53157114Sscottl	eh_globals.cc \
54157114Sscottl	eh_personality.cc \
55157114Sscottl	eh_term_handler.cc \
56157114Sscottl	eh_terminate.cc \
57157114Sscottl	eh_throw.cc \
58157114Sscottl	eh_type.cc \
59171821Sjhb	eh_unex_handler.cc \
60171821Sjhb	guard.cc \
61171821Sjhb	new_handler.cc \
62233711Sambrisko	new_op.cc \
63233711Sambrisko	new_opnt.cc \
64233711Sambrisko	new_opv.cc \
65233711Sambrisko	new_opvnt.cc \
66157114Sscottl	pure.cc \
67157114Sscottl	tinfo.cc \
68157114Sscottl	tinfo2.cc \
69157114Sscottl	vec.cc \
70157114Sscottl	vterminate.cc
71157114Sscottl
72157114Sscottllibsupc___la_SOURCES = $(sources) $(c_sources)
73157114Sscottllibsupc__convenience_la_SOURCES = $(sources) $(c_sources)
74157114Sscottl
75157114Sscottlglibcxxinstalldir = $(gxx_include_dir)
76157114Sscottlglibcxxinstall_HEADERS = $(headers)
77233711Sambrisko
78233711Sambrisko# AM_CXXFLAGS needs to be in each subdirectory so that it can be
79157114Sscottl# modified in a per-library or per-sub-library way.  Need to manually
80157114Sscottl# set this option because CONFIG_CXXFLAGS has to be after
81169451Sscottl# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
82169611Sscottl# as the occasion call for it.
83157114SscottlAM_CXXFLAGS = \
84157114Sscottl	-fno-implicit-templates \
85157114Sscottl	$(LIBSUPCXX_PICFLAGS) \
86162619Sscottl	$(WARN_CXXFLAGS) \
87157114Sscottl	$(OPTIMIZE_CXXFLAGS) \
88157114Sscottl	$(CONFIG_CXXFLAGS)
89233711Sambrisko
90157114SscottlAM_MAKEFLAGS = \
91233711Sambrisko	"gxx_include_dir=$(gxx_include_dir)"
92157114Sscottl
93157114Sscottl
94157114Sscottl# Use special rules for pulling things out of libiberty.  These
95157114Sscottl# objects should be compiled with the "C" compiler, not the C++
96225869Smav# compiler, and also should not use the C++ includes.
97157114SscottlC_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
98157114SscottlC_COMPILE = \
99157114Sscottl	$(CC) $(DEFS) $(C_INCLUDES) \
100157114Sscottl	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
101157114Sscottl
102157114Sscottl# LTCOMPILE is copied from LTCXXCOMPILE below.
103157114SscottlLTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared --mode=compile $(CC) \
104157114Sscottl	    $(DEFS) $(C_INCLUDES) $(LIBSUPCXX_PICFLAGS) \
105157114Sscottl            $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
106157114Sscottl
107157114Sscottlcp-demangle.c:
108157114Sscottl	rm -f $@
109158737Sambrisko	$(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
110233711Sambriskocp-demangle.lo: cp-demangle.c
111157114Sscottl	$(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
112157114Sscottlcp-demangle.o: cp-demangle.c
113162619Sscottl	$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
114170284Sambrisko
115157114Sscottl
116157114Sscottl# libstdc++ libtool notes
117169451Sscottl
118169451Sscottl# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
119169451Sscottl# last. (That way, things like -O2 passed down from the toplevel can
120169451Sscottl# be overridden by --enable-debug.)
121169451Sscottl
122169451Sscottl# 2) In general, libtool expects an argument such as `--tag=CXX' when
123159811Sps# using the C++ compiler, because that will enable the settings
124169451Sscottl# detected when C++ support was being configured.  However, when no
125169451Sscottl# such flag is given in the command line, libtool attempts to figure
126169451Sscottl# it out by matching the compiler name in each configuration section
127171821Sjhb# against a prefix of the command line.  The problem is that, if the
128157114Sscottl# compiler name and its initial flags stored in the libtool
129157114Sscottl# configuration file don't match those in the command line, libtool
130233711Sambrisko# can't decide which configuration to use, and it gives up.  The
131233711Sambrisko# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
132233711Sambrisko# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
133233711Sambrisko# attempt to infer which configuration to use.
134233711Sambrisko#
135233711Sambrisko# We have to put --tag disable-shared after --tag CXX lest things
136233711Sambrisko# CXX undo the affect of disable-shared.
137233711SambriskoLTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
138233711Sambrisko	       --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
139233711Sambrisko	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
140233711Sambrisko
141233711Sambrisko# 3) We'd have a problem when building the shared libstdc++ object if
142233711Sambrisko# the rules automake generates would be used.  We cannot allow g++ to
143233711Sambrisko# be used since this would add -lstdc++ to the link line which of
144233711Sambrisko# course is problematic at this point.  So, we get the top-level
145233711Sambrisko# directory to configure libstdc++-v3 to use gcc as the C++
146158737Sambrisko# compilation driver.
147158737SambriskoCXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
148158737Sambrisko	  --mode=link $(CXX) \
149158737Sambrisko	  $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LDFLAGS) -o $@
150158737Sambrisko
151233711Sambrisko# We have to have rules modified from the default to counteract SUN make
152233711Sambrisko# prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
153233711Sambriskoinstall-glibcxxinstallHEADERS: $(glibcxxinstall_HEADERS)
154233711Sambrisko	@$(NORMAL_INSTALL)
155233711Sambrisko	$(mkinstalldirs) $(DESTDIR)$(glibcxxinstalldir)
156233711Sambrisko	@list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
157233711Sambrisko	  q=`echo $$p | sed -e 's,.*/,,'`; \
158233711Sambrisko	  if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
159233711Sambrisko	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q"; \
160233711Sambrisko	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q; \
161233711Sambrisko	done
162233711Sambrisko
163233711Sambriskouninstall-glibcxxinstallHEADERS:
164233711Sambrisko	@$(NORMAL_UNINSTALL)
165233711Sambrisko	list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
166157114Sscottl	  q=`echo $$p | sed -e 's,.*/,,'`; \
167157114Sscottl	  rm -f $(DESTDIR)$(glibcxxinstalldir)/$$q; \
168157114Sscottl	done
169157114Sscottl