1## Makefile for the GNU C++ Support library.
2##
3## Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4##
5## Process this file with automake to produce Makefile.in.
6##
7## This file is part of GNU CC.
8##
9## GNU CC is free software; you can redistribute it and/or modify
10## it under the terms of the GNU General Public License as published by
11## the Free Software Foundation; either version 2, or (at your option)
12## any later version.
13##
14## GNU CC is distributed in the hope that it will be useful,
15## but WITHOUT ANY WARRANTY; without even the implied warranty of
16## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17## GNU General Public License for more details.
18##
19## You should have received a copy of the GNU General Public License
20## along with GNU CC; see the file COPYING.  If not, write to
21## the Free Software Foundation, 59 Temple Place - Suite 330,
22## Boston, MA 02111-1307, USA.
23
24AUTOMAKE_OPTIONS = 1.3 cygnus
25MAINT_CHARSET = latin1
26
27mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
28
29# Cross compiler and multilib support.
30CC = @CC@
31CXX = @glibcpp_CXX@
32toolexecdir = @glibcpp_toolexecdir@
33toolexeclibdir = @glibcpp_toolexeclibdir@
34
35
36# Need this library to both be part of libstdc++.a, and installed
37# separately too.
38# 1) separate libsupc++.la
39toolexeclib_LTLIBRARIES = libsupc++.la
40# 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a
41noinst_LTLIBRARIES = libsupc++convenience.la
42
43
44# Compile flags that should be constant throughout the build, both for
45# SUBDIRS and for libstdc++-v3 in general.
46OPTIMIZE_CXXFLAGS = @OPTIMIZE_CXXFLAGS@
47
48# These bits are all figured out from configure. Look in acinclude.m4
49# or configure.in to see how they are set. See GLIBCPP_EXPORT_FLAGS
50CONFIG_CXXFLAGS = \
51	@SECTION_FLAGS@ @EXTRA_CXX_FLAGS@
52
53# Warning flags to use.
54WARN_CXXFLAGS = \
55	@WARN_FLAGS@ $(WERROR) -fdiagnostics-show-location=once
56
57# Use common includes from acinclude.m4/GLIBCPP_EXPORT_INCLUDES
58GLIBCPP_INCLUDES = @GLIBCPP_INCLUDES@
59LIBSUPCXX_INCLUDES = @LIBSUPCXX_INCLUDES@
60GCC_INCLUDES = -I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include
61
62INCLUDES = \
63	$(GCC_INCLUDES) $(GLIBCPP_INCLUDES) $(LIBSUPCXX_INCLUDES)
64
65headers = \
66	exception new typeinfo cxxabi.h exception_defines.h
67
68c_sources = \
69	cxa_demangle.c \
70	dyn-string.c
71
72sources = \
73	del_op.cc \
74	del_opnt.cc \
75	del_opv.cc \
76	del_opvnt.cc \
77	eh_alloc.cc \
78	eh_aux_runtime.cc \
79	eh_catch.cc \
80	eh_exception.cc \
81	eh_globals.cc \
82	eh_personality.cc \
83	eh_terminate.cc \
84	eh_throw.cc \
85	eh_type.cc \
86	guard.cc \
87	new_handler.cc \
88	new_op.cc \
89	new_opnt.cc \
90	new_opv.cc \
91	new_opvnt.cc \
92	pure.cc \
93	tinfo.cc \
94	tinfo2.cc \
95	vec.cc
96
97libsupc___la_SOURCES = $(sources) $(c_sources)
98libsupc__convenience_la_SOURCES = $(sources) $(c_sources)
99
100glibcppinstalldir = $(gxx_include_dir)
101glibcppinstall_HEADERS = $(headers)
102
103LIBSUPCXX_CXXFLAGS = $(LIBSUPCXX_PICFLAGS)
104
105# Use special rules for pulling things out of libiberty.  These
106# objects should be compiled with the "C" compiler, not the C++
107# compiler, and also should not use the C++ includes.
108C_COMPILE = \
109	$(CC) $(DEFS) $(GCC_INCLUDES) \
110	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
111
112cxa_demangle.c:
113	rm -f $@
114	$(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
115cxa_demangle.lo: cxa_demangle.c
116	$(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
117cxa_demangle.o: cxa_demangle.c
118	$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
119dyn-string.c:
120	rm -f $@
121	$(LN_S) $(toplevel_srcdir)/libiberty/dyn-string.c $@
122dyn-string.lo: dyn-string.c
123	$(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
124dyn-string.o: dyn-string.c
125	$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
126
127# LTCOMPILE is copied from LTCXXCOMPILE below.
128LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared --mode=compile $(CC) \
129	    $(DEFS) $(GCC_INCLUDES) $(LIBSUPCXX_PICFLAGS) \
130            $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
131
132
133# AM_CXXFLAGS needs to be in each subdirectory so that it can be
134# modified in a per-library or per-sub-library way.  Need to manually
135# set this option because CONFIG_CXXFLAGS has to be after
136# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
137# as the occasion call for it. (ie, --enable-debug)
138AM_CXXFLAGS = \
139	-fno-implicit-templates \
140	$(LIBSUPCXX_CXXFLAGS) \
141	$(WARN_CXXFLAGS) \
142	$(OPTIMIZE_CXXFLAGS) \
143	$(CONFIG_CXXFLAGS)
144
145AM_MAKEFLAGS = \
146	"gxx_include_dir=$(gxx_include_dir)"
147
148# libstdc++ libtool notes
149
150# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
151# last. (That way, things like -O2 passed down from the toplevel can
152# be overridden by --enable-debug.)
153
154# 2) In general, libtool expects an argument such as `--tag=CXX' when
155# using the C++ compiler, because that will enable the settings
156# detected when C++ support was being configured.  However, when no
157# such flag is given in the command line, libtool attempts to figure
158# it out by matching the compiler name in each configuration section
159# against a prefix of the command line.  The problem is that, if the
160# compiler name and its initial flags stored in the libtool
161# configuration file don't match those in the command line, libtool
162# can't decide which configuration to use, and it gives up.  The
163# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
164# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
165# attempt to infer which configuration to use.
166#
167# We have to put --tag disable-shared after --tag CXX lest things
168# CXX undo the affect of disable-shared.
169LTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
170               --mode=compile $(CXX) $(INCLUDES) \
171	       $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS)
172
173# 3) We'd have a problem when building the shared libstdc++ object if
174# the rules automake generates would be used.  We cannot allow g++ to
175# be used since this would add -lstdc++ to the link line which of
176# course is problematic at this point.  So, we get the top-level
177# directory to configure libstdc++-v3 to use gcc as the C++
178# compilation driver.
179CXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
180          --mode=link $(CXX) \
181          @OPT_LDFLAGS@ @SECTION_LDFLAGS@ $(AM_CXXFLAGS) $(LDFLAGS) -o $@
182
183# We have to have rules modified from the default to counteract SUN make
184# prepending each of $(glibcppinstall_HEADERS) with VPATH below.
185install-glibcppinstallHEADERS: $(glibcppinstall_HEADERS)
186	@$(NORMAL_INSTALL)
187	$(mkinstalldirs) $(DESTDIR)$(glibcppinstalldir)
188	@list='$(glibcppinstall_HEADERS)'; for p in $$list; do \
189	  q=`echo $$p | sed -e 's,.*/,,'`; \
190	  if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
191	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcppinstalldir)/$$q"; \
192	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcppinstalldir)/$$q; \
193	done
194
195uninstall-glibcppinstallHEADERS:
196	@$(NORMAL_UNINSTALL)
197	list='$(glibcppinstall_HEADERS)'; for p in $$list; do \
198	  q=`echo $$p | sed -e 's,.*/,,'`; \
199	  rm -f $(DESTDIR)$(glibcppinstalldir)/$$q; \
200	done
201