1## Makefile for the GNU C++ Support library.
2##
3## Copyright (C) 2000-2022 Free Software Foundation, Inc.
4##
5## Process this file with automake to produce Makefile.in.
6##
7## This file is part of GCC.
8##
9## GCC 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 3, or (at your option)
12## any later version.
13##
14## GCC 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 GCC; see the file COPYING3.  If not see
21## <http://www.gnu.org/licenses/>.
22
23include $(top_srcdir)/fragment.am
24
25# Need this library to both be part of libstdc++.a, and installed
26# separately too.
27# 1) separate libsupc++.la
28toolexeclib_LTLIBRARIES = libsupc++.la
29
30# 2) integrated libsupc++convenience.la that is to be a part of libstdc++.a
31noinst_LTLIBRARIES = libsupc++convenience.la
32
33std_HEADERS = \
34          compare cxxabi.h exception initializer_list new typeinfo
35
36bits_HEADERS = \
37          atomic_lockfree_defines.h cxxabi_forced.h \
38          exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h exception.h cxxabi_init_exception.h
39
40headers = $(std_HEADERS) $(bits_HEADERS)
41
42if GLIBCXX_HOSTED
43  c_sources = \
44          cp-demangle.c
45endif
46
47sources = \
48          array_type_info.cc \
49          atexit_arm.cc \
50          atexit_thread.cc \
51          atomicity.cc \
52          bad_alloc.cc \
53          bad_array_length.cc \
54          bad_array_new.cc \
55          bad_cast.cc \
56          bad_typeid.cc \
57          class_type_info.cc \
58          del_op.cc \
59          del_ops.cc \
60          del_opnt.cc \
61          del_opv.cc \
62          del_opvs.cc \
63          del_opvnt.cc \
64          dyncast.cc \
65          eh_alloc.cc \
66          eh_arm.cc \
67          eh_aux_runtime.cc \
68          eh_call.cc \
69          eh_catch.cc \
70          eh_exception.cc \
71          eh_globals.cc \
72          eh_personality.cc \
73          eh_ptr.cc \
74          eh_term_handler.cc \
75          eh_terminate.cc \
76          eh_tm.cc \
77          eh_throw.cc \
78          eh_type.cc \
79          eh_unex_handler.cc \
80          enum_type_info.cc \
81          function_type_info.cc \
82          fundamental_type_info.cc \
83          guard.cc \
84          guard_error.cc \
85          hash_bytes.cc \
86          nested_exception.cc \
87          new_handler.cc \
88          new_op.cc \
89          new_opnt.cc \
90          new_opv.cc \
91          new_opvnt.cc \
92          new_opa.cc \
93          new_opant.cc \
94          new_opva.cc \
95          new_opvant.cc \
96          del_opa.cc \
97          del_opant.cc \
98          del_opsa.cc \
99          del_opva.cc \
100          del_opvant.cc \
101          del_opvsa.cc \
102          pbase_type_info.cc \
103          pmem_type_info.cc \
104          pointer_type_info.cc \
105          pure.cc \
106          si_class_type_info.cc \
107          tinfo.cc \
108          tinfo2.cc \
109          vec.cc \
110          vmi_class_type_info.cc \
111          vterminate.cc
112
113if ENABLE_VTABLE_VERIFY
114if !VTV_CYGMIN
115  vtv_sources = \
116          vtv_stubs.cc
117endif
118endif
119
120libsupc___la_SOURCES = $(sources) $(c_sources) $(vtv_sources)
121libsupc__convenience_la_SOURCES = $(sources) $(c_sources) $(vtv_sources)
122
123cp-demangle.c:
124          rm -f $@
125          $(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
126cp-demangle.lo: cp-demangle.c
127          $(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
128cp-demangle.o: cp-demangle.c
129          $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
130
131atomicity_file = ${glibcxx_srcdir}/$(ATOMICITY_SRCDIR)/atomicity.h
132atomicity.cc: ${atomicity_file}
133          $(LN_S) ${atomicity_file} ./atomicity.cc || true
134
135if OS_IS_DARWIN
136# See PR 112397
137new_opvnt.lo: new_opvnt.cc
138          $(LTCXXCOMPILE) -fno-reorder-blocks-and-partition -I. -c $<
139new_opvnt.o: new_opvnt.cc
140          $(CXXCOMPILE) -fno-reorder-blocks-and-partition -I. -c $<
141endif
142
143# AM_CXXFLAGS needs to be in each subdirectory so that it can be
144# modified in a per-library or per-sub-library way.  Need to manually
145# set this option because CONFIG_CXXFLAGS has to be after
146# OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
147# as the occasion call for it.
148AM_CXXFLAGS = \
149          $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
150          $(XTEMPLATE_FLAGS) $(FREESTANDING_FLAGS) \
151          $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS)  $(CONFIG_CXXFLAGS)
152
153AM_MAKEFLAGS = \
154          "gxx_include_dir=$(gxx_include_dir)"
155
156
157# Use special rules for pulling things out of libiberty.  These
158# objects should be compiled with the "C" compiler, not the C++
159# compiler, and also should not use the C++ includes.
160C_INCLUDES = -I.. -I$(toplevel_srcdir)/libiberty -I$(toplevel_srcdir)/include
161C_COMPILE = \
162          $(CC) $(DEFS) $(C_INCLUDES) \
163          $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
164
165# LTCOMPILE is copied from LTCXXCOMPILE below.
166LTCOMPILE = $(LIBTOOL) --tag CC --tag disable-shared $(LIBTOOLFLAGS) --mode=compile \
167              $(CC) $(DEFS) $(C_INCLUDES) \
168              $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
169              $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
170
171# Libtool notes
172
173# 1) In general, libtool expects an argument such as `--tag=CXX' when
174# using the C++ compiler, because that will enable the settings
175# detected when C++ support was being configured.  However, when no
176# such flag is given in the command line, libtool attempts to figure
177# it out by matching the compiler name in each configuration section
178# against a prefix of the command line.  The problem is that, if the
179# compiler name and its initial flags stored in the libtool
180# configuration file don't match those in the command line, libtool
181# can't decide which configuration to use, and it gives up.  The
182# correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
183# CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
184# attempt to infer which configuration to use.
185#
186# The second tag argument, `--tag disable-shared` means that libtool
187# only compiles each source once, for static objects. In actuality,
188# glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
189# the libtool command that is used create the object, which is
190# suitable for shared libraries.  The `--tag disable-shared` must be
191# placed after --tag CXX lest things CXX undo the affect of
192# disable-shared.
193
194# 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
195# last. (That way, things like -O2 passed down from the toplevel can
196# be overridden by --enable-debug.)
197LTCXXCOMPILE = \
198          $(LIBTOOL) --tag CXX --tag disable-shared \
199          $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
200          --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
201          $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
202
203LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
204
205# 3) We'd have a problem when building the shared libstdc++ object if
206# the rules automake generates would be used.  We cannot allow g++ to
207# be used since this would add -lstdc++ to the link line which of
208# course is problematic at this point.  So, we get the top-level
209# directory to configure libstdc++-v3 to use gcc as the C++
210# compilation driver.
211CXXLINK = \
212          $(LIBTOOL) --tag CXX --tag disable-shared \
213          $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
214          --mode=link $(CXX) \
215          $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@
216
217# Install notes
218# We have to have rules modified from the default to counteract SUN make
219# prepending each of $(*_HEADERS) with VPATH below.
220stddir = $(gxx_include_dir)
221bitsdir = $(gxx_include_dir)/bits
222
223install-stdHEADERS: $(std_HEADERS)
224          @$(NORMAL_INSTALL)
225          $(mkinstalldirs) $(DESTDIR)$(stddir)
226          @list='$(std_HEADERS)'; for p in $$list; do \
227            q=`echo $$p | sed -e 's,.*/,,'`; \
228            if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
229            echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(stddir)/$$q"; \
230            $(INSTALL_DATA) $$d$$p $(DESTDIR)$(stddir)/$$q; \
231          done
232
233install-bitsHEADERS: $(bits_HEADERS)
234          @$(NORMAL_INSTALL)
235          $(mkinstalldirs) $(DESTDIR)$(bitsdir)
236          @list='$(bits_HEADERS)'; for p in $$list; do \
237            q=`echo $$p | sed -e 's,.*/,,'`; \
238            if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
239            echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(bitsdir)/$$q"; \
240            $(INSTALL_DATA) $$d$$p $(DESTDIR)$(bitsdir)/$$q; \
241          done
242
243uninstall-stdHEADERS:
244          @$(NORMAL_UNINSTALL)
245          list='$(std_HEADERS)'; for p in $$list; do \
246            q=`echo $$p | sed -e 's,.*/,,'`; \
247            rm -f $(DESTDIR)$(stddir)/$$q; \
248          done
249
250uninstall-bitsHEADERS:
251          @$(NORMAL_UNINSTALL)
252          list='$(bits_HEADERS)'; for p in $$list; do \
253            q=`echo $$p | sed -e 's,.*/,,'`; \
254            rm -f $(DESTDIR)$(bitsdir)/$$q; \
255          done
256
257
258# By adding these files here, automake will remove them for 'make clean'
259CLEANFILES = stamp-*
260
261