[RISC-V][PR target/116283] Fix split code for recent Zbs improvements with masked...
[official-gcc.git] / libstdc++-v3 / src / c++11 / Makefile.am
blob89e20ca3b06b149a5dac7fc03ae59329e1de0cd2
1 ## Makefile for the C++11 sources of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 1997-2024 Free Software Foundation, Inc.
4 ##
5 ## This file is part of the libstdc++ version 3 distribution.
6 ## Process this file with automake to produce Makefile.in.
8 ## This file is part of the GNU ISO C++ Library.  This library is free
9 ## software; you can redistribute it and/or modify it under the
10 ## terms of the GNU General Public License as published by the
11 ## Free Software Foundation; either version 3, or (at your option)
12 ## any later version.
14 ## This library 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.
19 ## You should have received a copy of the GNU General Public License along
20 ## with this library; see the file COPYING3.  If not see
21 ## <http://www.gnu.org/licenses/>.
23 include $(top_srcdir)/fragment.am
25 # Convenience library for C++11 runtime.
26 noinst_LTLIBRARIES = libc++11convenience.la
28 headers =
30 # Source files linked in via configuration/make substitution for a
31 # particular host.
32 host_sources = \
33         ctype_configure_char.cc \
34         ctype_members.cc
36 ctype_configure_char.cc: ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc
37         $(LN_S) ${glibcxx_srcdir}/$(OS_INC_SRCDIR)/ctype_configure_char.cc . || true
39 ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
40         $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
42 # Source files linked in via configuration/make substitution for a
43 # particular host, but with ad hoc naming rules.
44 host_sources_extra = \
45         basic_file.cc
47 basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
48         $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
50 if ENABLE_DUAL_ABI
51 cxx11_abi_sources = \
52         cow-locale_init.cc \
53         cow-shim_facets.cc \
54         cxx11-hash_tr1.cc \
55         cxx11-ios_failure.cc \
56         cxx11-shim_facets.cc \
57         cxx11-stdexcept.cc
58 else
59 cxx11_abi_sources =
60 endif
62 sources_freestanding = \
63         limits.cc \
64         placeholders.cc
66 sources = \
67         assert_fail.cc \
68         chrono.cc \
69         codecvt.cc \
70         condition_variable.cc \
71         cow-stdexcept.cc \
72         ctype.cc \
73         debug.cc \
74         functexcept.cc \
75         functional.cc \
76         futex.cc \
77         future.cc \
78         hash_c++0x.cc \
79         hashtable_c++0x.cc \
80         ios.cc \
81         ios_errcat.cc \
82         locale_init.cc \
83         localename.cc \
84         mutex.cc \
85         random.cc \
86         regex.cc  \
87         shared_ptr.cc \
88         snprintf_lite.cc \
89         system_error.cc \
90         thread.cc \
91         ${cxx11_abi_sources} \
92         ${host_sources} \
93         ${host_sources_extra}
95 if ENABLE_DUAL_ABI
96 extra_string_inst_sources = \
97         cow-fstream-inst.cc \
98         cow-sstream-inst.cc \
99         cow-string-inst.cc \
100         cow-string-io-inst.cc \
101         cow-wstring-inst.cc \
102         cow-wstring-io-inst.cc \
103         cxx11-locale-inst.cc \
104         cxx11-wlocale-inst.cc \
105         sso_string.cc
106 else
107 extra_string_inst_sources =
108 endif
110 if ENABLE_EXTERN_TEMPLATE
111 # XTEMPLATE_FLAGS = -fno-implicit-templates
112 inst_sources = \
113         $(extra_string_inst_sources) \
114         ext11-inst.cc \
115         fstream-inst.cc \
116         ios-inst.cc \
117         iostream-inst.cc \
118         istream-inst.cc \
119         locale-inst.cc \
120         ostream-inst.cc \
121         sstream-inst.cc \
122         streambuf-inst.cc \
123         string-inst.cc \
124         string-io-inst.cc \
125         wlocale-inst.cc \
126         wstring-inst.cc \
127         wstring-io-inst.cc
128 else
129 # XTEMPLATE_FLAGS =
130 inst_sources =
131 endif
133 vpath % $(top_srcdir)/src/c++11
135 if !GLIBCXX_HOSTED
136 libc__11convenience_la_SOURCES = $(sources_freestanding)
137 else
138 libc__11convenience_la_SOURCES = \
139         $(sources_freestanding) \
140         $(sources) \
141         $(inst_sources)
142 endif
145 # Use special rules for the hashtable.cc file so that all
146 # the generated template functions are also instantiated.
147 hashtable_c++0x.lo: hashtable_c++0x.cc
148         $(LTCXXCOMPILE) -fimplicit-templates -c $<
149 hashtable_c++0x.o: hashtable_c++0x.cc
150         $(CXXCOMPILE) -fimplicit-templates -c $<
152 # Use special rules for source files that require -fchar8_t.
153 codecvt.lo: codecvt.cc
154         $(LTCXXCOMPILE) -fchar8_t -c $<
155 codecvt.o: codecvt.cc
156         $(CXXCOMPILE) -fchar8_t -c $<
157 limits.lo: limits.cc
158         $(LTCXXCOMPILE) -fchar8_t -c $<
159 limits.o: limits.cc
160         $(CXXCOMPILE) -fchar8_t -c $<
161 locale_init.lo: locale_init.cc
162         $(LTCXXCOMPILE) -fchar8_t -c $<
163 locale_init.o: locale_init.cc
164         $(CXXCOMPILE) -fchar8_t -c $<
165 localename.lo: localename.cc
166         $(LTCXXCOMPILE) -fchar8_t -c $<
167 localename.o: localename.cc
168         $(CXXCOMPILE) -fchar8_t -c $<
170 if ENABLE_DUAL_ABI
171 # Rewrite the type info for __ios_failure.
172 rewrite_ios_failure_typeinfo = sed -e '/^_*_ZTISt13__ios_failure:/,/_ZTVN10__cxxabiv120__si_class_type_infoE/s/_ZTVN10__cxxabiv120__si_class_type_infoE/_ZTVSt19__iosfail_type_info/'
174 cxx11-ios_failure-lt.s: cxx11-ios_failure.cc
175         $(LTCXXCOMPILE) -gno-as-loc-support -S $< -o tmp-cxx11-ios_failure-lt.s
176         -test -f tmp-cxx11-ios_failure-lt.o && mv -f tmp-cxx11-ios_failure-lt.o tmp-cxx11-ios_failure-lt.s
177         $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
178         -rm -f tmp-$@
179 cxx11-ios_failure.s: cxx11-ios_failure.cc
180         $(CXXCOMPILE) -gno-as-loc-support -S $< -o tmp-$@
181         $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
182         -rm -f tmp-$@
184 cxx11-ios_failure.lo: cxx11-ios_failure-lt.s
185         $(LTCXXCOMPILE) -g0 -c $< -o $@
186 cxx11-ios_failure.o: cxx11-ios_failure.s
187         $(CXXCOMPILE) -g0 -c $<
188 endif
190 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
191 # modified in a per-library or per-sub-library way.  Need to manually
192 # set this option because CONFIG_CXXFLAGS has to be after
193 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
194 # as the occasion calls for it.
195 AM_CXXFLAGS = \
196         -std=gnu++11 \
197         $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
198         $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
199         $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
201 AM_MAKEFLAGS = \
202         "gxx_include_dir=$(gxx_include_dir)"
204 # Libtool notes
206 # 1) In general, libtool expects an argument such as `--tag=CXX' when
207 # using the C++ compiler, because that will enable the settings
208 # detected when C++ support was being configured.  However, when no
209 # such flag is given in the command line, libtool attempts to figure
210 # it out by matching the compiler name in each configuration section
211 # against a prefix of the command line.  The problem is that, if the
212 # compiler name and its initial flags stored in the libtool
213 # configuration file don't match those in the command line, libtool
214 # can't decide which configuration to use, and it gives up.  The
215 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
216 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
217 # attempt to infer which configuration to use.
219 # The second tag argument, `--tag disable-shared` means that libtool
220 # only compiles each source once, for static objects. In actuality,
221 # glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
222 # the libtool command that is used create the object, which is
223 # suitable for shared libraries.  The `--tag disable-shared` must be
224 # placed after --tag CXX lest things CXX undo the affect of
225 # disable-shared.
227 # 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
228 # last. (That way, things like -O2 passed down from the toplevel can
229 # be overridden by --enable-debug.)
230 LTCXXCOMPILE = \
231         $(LIBTOOL) --tag CXX --tag disable-shared \
232         $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
233         --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
234         $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
236 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
238 # 3) We'd have a problem when building the shared libstdc++ object if
239 # the rules automake generates would be used.  We cannot allow g++ to
240 # be used since this would add -lstdc++ to the link line which of
241 # course is problematic at this point.  So, we get the top-level
242 # directory to configure libstdc++-v3 to use gcc as the C++
243 # compilation driver.
244 CXXLINK = \
245         $(LIBTOOL) --tag CXX --tag disable-shared \
246         $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
247         --mode=link $(CXX) \
248         $(VTV_CXXLINKFLAGS) \
249         $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@