xref: /openbsd-src/gnu/gcc/libstdc++-v3/libsupc++/Makefile.am (revision 404b540a9034ac75a6199ad1a32d1bbc7a0d4210)
1*404b540aSrobert## Makefile for the GNU C++ Support library.
2*404b540aSrobert##
3*404b540aSrobert## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005
4*404b540aSrobert## Free Software Foundation, Inc.
5*404b540aSrobert##
6*404b540aSrobert## Process this file with automake to produce Makefile.in.
7*404b540aSrobert##
8*404b540aSrobert## This file is part of GCC.
9*404b540aSrobert##
10*404b540aSrobert## GCC is free software; you can redistribute it and/or modify
11*404b540aSrobert## it under the terms of the GNU General Public License as published by
12*404b540aSrobert## the Free Software Foundation; either version 2, or (at your option)
13*404b540aSrobert## any later version.
14*404b540aSrobert##
15*404b540aSrobert## GCC is distributed in the hope that it will be useful,
16*404b540aSrobert## but WITHOUT ANY WARRANTY; without even the implied warranty of
17*404b540aSrobert## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*404b540aSrobert## GNU General Public License for more details.
19*404b540aSrobert##
20*404b540aSrobert## You should have received a copy of the GNU General Public License
21*404b540aSrobert## along with GCC; see the file COPYING.  If not, write to
22*404b540aSrobert## the Free Software Foundation, 51 Franklin Street, Fifth Floor,
23*404b540aSrobert## Boston, MA 02110-1301, USA.
24*404b540aSrobert
25*404b540aSrobertinclude $(top_srcdir)/fragment.am
26*404b540aSrobert
27*404b540aSrobert# Need this library to both be part of libstdc++.a, and installed
28*404b540aSrobert# separately too.
29*404b540aSrobert# 1) separate libsupc++.la
30*404b540aSroberttoolexeclib_LTLIBRARIES = libsupc++.la
31*404b540aSrobert# 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a
32*404b540aSrobertnoinst_LTLIBRARIES = libsupc++convenience.la
33*404b540aSrobert
34*404b540aSrobert
35*404b540aSrobertheaders = \
36*404b540aSrobert	exception new typeinfo cxxabi.h exception_defines.h
37*404b540aSrobert
38*404b540aSrobertif GLIBCXX_HOSTED
39*404b540aSrobert  c_sources = \
40*404b540aSrobert	cp-demangle.c
41*404b540aSrobertendif
42*404b540aSrobert
43*404b540aSrobertsources = \
44*404b540aSrobert	del_op.cc \
45*404b540aSrobert	del_opnt.cc \
46*404b540aSrobert	del_opv.cc \
47*404b540aSrobert	del_opvnt.cc \
48*404b540aSrobert	eh_alloc.cc \
49*404b540aSrobert	eh_arm.cc \
50*404b540aSrobert	eh_aux_runtime.cc \
51*404b540aSrobert	eh_call.cc \
52*404b540aSrobert	eh_catch.cc \
53*404b540aSrobert	eh_exception.cc \
54*404b540aSrobert	eh_globals.cc \
55*404b540aSrobert	eh_personality.cc \
56*404b540aSrobert	eh_term_handler.cc \
57*404b540aSrobert	eh_terminate.cc \
58*404b540aSrobert	eh_throw.cc \
59*404b540aSrobert	eh_type.cc \
60*404b540aSrobert	eh_unex_handler.cc \
61*404b540aSrobert	guard.cc \
62*404b540aSrobert	new_handler.cc \
63*404b540aSrobert	new_op.cc \
64*404b540aSrobert	new_opnt.cc \
65*404b540aSrobert	new_opv.cc \
66*404b540aSrobert	new_opvnt.cc \
67*404b540aSrobert	pure.cc \
68*404b540aSrobert	tinfo.cc \
69*404b540aSrobert	tinfo2.cc \
70*404b540aSrobert	vec.cc \
71*404b540aSrobert	vterminate.cc
72*404b540aSrobert
73*404b540aSrobertlibsupc___la_SOURCES = $(sources) $(c_sources)
74*404b540aSrobertlibsupc__convenience_la_SOURCES = $(sources) $(c_sources)
75*404b540aSrobert
76*404b540aSrobertglibcxxinstalldir = $(gxx_include_dir)
77*404b540aSrobertglibcxxinstall_HEADERS = $(headers)
78*404b540aSrobert
79*404b540aSrobert# AM_CXXFLAGS needs to be in each subdirectory so that it can be
80*404b540aSrobert# modified in a per-library or per-sub-library way.  Need to manually
81*404b540aSrobert# set this option because CONFIG_CXXFLAGS has to be after
82*404b540aSrobert# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
83*404b540aSrobert# as the occasion call for it.
84*404b540aSrobertAM_CXXFLAGS = \
85*404b540aSrobert	-fno-implicit-templates \
86*404b540aSrobert	$(LIBSUPCXX_PICFLAGS) \
87*404b540aSrobert	$(WARN_CXXFLAGS) \
88*404b540aSrobert	$(OPTIMIZE_CXXFLAGS) \
89*404b540aSrobert	$(CONFIG_CXXFLAGS)
90*404b540aSrobert
91*404b540aSrobertAM_MAKEFLAGS = \
92*404b540aSrobert	"gxx_include_dir=$(gxx_include_dir)"
93*404b540aSrobert
94*404b540aSrobert
95*404b540aSrobert# Use special rules for pulling things out of libiberty.  These
96*404b540aSrobert# objects should be compiled with the "C" compiler, not the C++
97*404b540aSrobert# compiler, and also should not use the C++ includes.
98*404b540aSrobertC_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
99*404b540aSrobertC_COMPILE = \
100*404b540aSrobert	$(CC) $(DEFS) $(C_INCLUDES) \
101*404b540aSrobert	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
102*404b540aSrobert
103*404b540aSrobert# LTCOMPILE is copied from LTCXXCOMPILE below.
104*404b540aSrobertLTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared --mode=compile $(CC) \
105*404b540aSrobert	    $(DEFS) $(C_INCLUDES) $(LIBSUPCXX_PICFLAGS) \
106*404b540aSrobert            $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
107*404b540aSrobert
108*404b540aSrobertcp-demangle.c:
109*404b540aSrobert	rm -f $@
110*404b540aSrobert	$(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
111*404b540aSrobertcp-demangle.lo: cp-demangle.c
112*404b540aSrobert	$(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
113*404b540aSrobertcp-demangle.o: cp-demangle.c
114*404b540aSrobert	$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
115*404b540aSrobert
116*404b540aSrobert
117*404b540aSrobert# libstdc++ libtool notes
118*404b540aSrobert
119*404b540aSrobert# 1) Need to explicitly set LTCXXCOMPILE so that AM_CXXFLAGS is
120*404b540aSrobert# last. (That way, things like -O2 passed down from the toplevel can
121*404b540aSrobert# be overridden by --enable-debug.)
122*404b540aSrobert
123*404b540aSrobert# 2) In general, libtool expects an argument such as `--tag=CXX' when
124*404b540aSrobert# using the C++ compiler, because that will enable the settings
125*404b540aSrobert# detected when C++ support was being configured.  However, when no
126*404b540aSrobert# such flag is given in the command line, libtool attempts to figure
127*404b540aSrobert# it out by matching the compiler name in each configuration section
128*404b540aSrobert# against a prefix of the command line.  The problem is that, if the
129*404b540aSrobert# compiler name and its initial flags stored in the libtool
130*404b540aSrobert# configuration file don't match those in the command line, libtool
131*404b540aSrobert# can't decide which configuration to use, and it gives up.  The
132*404b540aSrobert# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
133*404b540aSrobert# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
134*404b540aSrobert# attempt to infer which configuration to use.
135*404b540aSrobert#
136*404b540aSrobert# We have to put --tag disable-shared after --tag CXX lest things
137*404b540aSrobert# CXX undo the affect of disable-shared.
138*404b540aSrobertLTCXXCOMPILE = $(LIBTOOL) --tag CXX --tag disable-shared \
139*404b540aSrobert	       --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
140*404b540aSrobert	       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
141*404b540aSrobert
142*404b540aSrobertLTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
143*404b540aSrobert
144*404b540aSrobert# 3) We'd have a problem when building the shared libstdc++ object if
145*404b540aSrobert# the rules automake generates would be used.  We cannot allow g++ to
146*404b540aSrobert# be used since this would add -lstdc++ to the link line which of
147*404b540aSrobert# course is problematic at this point.  So, we get the top-level
148*404b540aSrobert# directory to configure libstdc++-v3 to use gcc as the C++
149*404b540aSrobert# compilation driver.
150*404b540aSrobertCXXLINK = $(LIBTOOL) --tag CXX --tag disable-shared \
151*404b540aSrobert	  --mode=link $(CXX) \
152*404b540aSrobert	  $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
153*404b540aSrobert
154*404b540aSrobert# We have to have rules modified from the default to counteract SUN make
155*404b540aSrobert# prepending each of $(glibcxxinstall_HEADERS) with VPATH below.
156*404b540aSrobertinstall-glibcxxinstallHEADERS: $(glibcxxinstall_HEADERS)
157*404b540aSrobert	@$(NORMAL_INSTALL)
158*404b540aSrobert	$(mkinstalldirs) $(DESTDIR)$(glibcxxinstalldir)
159*404b540aSrobert	@list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
160*404b540aSrobert	  q=`echo $$p | sed -e 's,.*/,,'`; \
161*404b540aSrobert	  if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
162*404b540aSrobert	  echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q"; \
163*404b540aSrobert	  $(INSTALL_DATA) $$d$$p $(DESTDIR)$(glibcxxinstalldir)/$$q; \
164*404b540aSrobert	done
165*404b540aSrobert
166*404b540aSrobertuninstall-glibcxxinstallHEADERS:
167*404b540aSrobert	@$(NORMAL_UNINSTALL)
168*404b540aSrobert	list='$(glibcxxinstall_HEADERS)'; for p in $$list; do \
169*404b540aSrobert	  q=`echo $$p | sed -e 's,.*/,,'`; \
170*404b540aSrobert	  rm -f $(DESTDIR)$(glibcxxinstalldir)/$$q; \
171*404b540aSrobert	done
172