Debian Codegraph @

libstdc++-v3/src/c++11/Makefile.am

raw
1 ## Makefile for the C++11 sources of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 1997-2025 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.
7
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.
13
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.
18
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/>.
22
23 include $(top_srcdir)/fragment.am
24
25 # Convenience library for C++11 runtime.
26 noinst_LTLIBRARIES = libc++11convenience.la
27
28 headers =
29
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
35
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
38
39 ctype_members.cc: ${glibcxx_srcdir}/$(CCTYPE_CC)
40 $(LN_S) ${glibcxx_srcdir}/$(CCTYPE_CC) . || true
41
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
46
47 basic_file.cc: ${glibcxx_srcdir}/$(BASIC_FILE_CC)
48 $(LN_S) ${glibcxx_srcdir}/$(BASIC_FILE_CC) ./$@ || true
49
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
61
62 sources_freestanding = \
63 limits.cc \
64 placeholders.cc
65
66 sources = \
67 assert_fail.cc \
68 chrono.cc \
69 codecvt.cc \
70 condition_variable.cc \
71 cow-stdexcept.cc \
72 cow-system_error.cc \
73 ctype.cc \
74 debug.cc \
75 functexcept.cc \
76 functional.cc \
77 futex.cc \
78 future.cc \
79 hash_c++0x.cc \
80 hashtable_c++0x.cc \
81 ios.cc \
82 ios_errcat.cc \
83 locale_init.cc \
84 localename.cc \
85 mutex.cc \
86 random.cc \
87 regex.cc \
88 shared_ptr.cc \
89 snprintf_lite.cc \
90 system_error.cc \
91 thread.cc \
92 ${cxx11_abi_sources} \
93 ${host_sources} \
94 ${host_sources_extra}
95
96 if ENABLE_DUAL_ABI
97 extra_string_inst_sources = \
98 cow-fstream-inst.cc \
99 cow-sstream-inst.cc \
100 cow-string-inst.cc \
101 cow-string-io-inst.cc \
102 cow-wstring-inst.cc \
103 cow-wstring-io-inst.cc \
104 cxx11-locale-inst.cc \
105 cxx11-wlocale-inst.cc \
106 sso_string.cc
107 else
108 extra_string_inst_sources =
109 endif
110
111 if ENABLE_EXTERN_TEMPLATE
112 # XTEMPLATE_FLAGS = -fno-implicit-templates
113 inst_sources = \
114 $(extra_string_inst_sources) \
115 ext11-inst.cc \
116 fstream-inst.cc \
117 ios-inst.cc \
118 iostream-inst.cc \
119 istream-inst.cc \
120 locale-inst.cc \
121 ostream-inst.cc \
122 sstream-inst.cc \
123 streambuf-inst.cc \
124 string-inst.cc \
125 string-io-inst.cc \
126 wlocale-inst.cc \
127 wstring-inst.cc \
128 wstring-io-inst.cc
129 else
130 # XTEMPLATE_FLAGS =
131 inst_sources =
132 endif
133
134 vpath % $(top_srcdir)/src/c++11
135
136 if !GLIBCXX_HOSTED
137 libc__11convenience_la_SOURCES = $(sources_freestanding)
138 else
139 libc__11convenience_la_SOURCES = \
140 $(sources_freestanding) \
141 $(sources) \
142 $(inst_sources)
143 endif
144
145
146 # Use special rules for the hashtable.cc file so that all
147 # the generated template functions are also instantiated.
148 hashtable_c++0x.lo: hashtable_c++0x.cc
149 $(LTCXXCOMPILE) -fimplicit-templates -c $<
150 hashtable_c++0x.o: hashtable_c++0x.cc
151 $(CXXCOMPILE) -fimplicit-templates -c $<
152
153 # Use special rules for source files that require -fchar8_t.
154 codecvt.lo: codecvt.cc
155 $(LTCXXCOMPILE) -fchar8_t -c $<
156 codecvt.o: codecvt.cc
157 $(CXXCOMPILE) -fchar8_t -c $<
158 limits.lo: limits.cc
159 $(LTCXXCOMPILE) -fchar8_t -c $<
160 limits.o: limits.cc
161 $(CXXCOMPILE) -fchar8_t -c $<
162 locale_init.lo: locale_init.cc
163 $(LTCXXCOMPILE) -fchar8_t -c $<
164 locale_init.o: locale_init.cc
165 $(CXXCOMPILE) -fchar8_t -c $<
166 localename.lo: localename.cc
167 $(LTCXXCOMPILE) -fchar8_t -c $<
168 localename.o: localename.cc
169 $(CXXCOMPILE) -fchar8_t -c $<
170
171 if ENABLE_DUAL_ABI
172 # Rewrite the type info for __ios_failure.
173 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
175 cxx11-ios_failure-lt.s: cxx11-ios_failure.cc
176 $(LTCXXCOMPILE) -gno-as-loc-support -S $< -o tmp-cxx11-ios_failure-lt.s
177 -test -f tmp-cxx11-ios_failure-lt.o && mv -f tmp-cxx11-ios_failure-lt.o tmp-cxx11-ios_failure-lt.s
178 $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
179 -rm -f tmp-$@
180 cxx11-ios_failure.s: cxx11-ios_failure.cc
181 $(CXXCOMPILE) -gno-as-loc-support -S $< -o tmp-$@
182 $(rewrite_ios_failure_typeinfo) tmp-$@ > $@
183 -rm -f tmp-$@
184
185 cxx11-ios_failure.lo: cxx11-ios_failure-lt.s
186 $(LTCXXCOMPILE) -g0 -c $< -o $@
187 cxx11-ios_failure.o: cxx11-ios_failure.s
188 $(CXXCOMPILE) -g0 -c $<
189 endif
190
191 # AM_CXXFLAGS needs to be in each subdirectory so that it can be
192 # modified in a per-library or per-sub-library way. Need to manually
193 # set this option because CONFIG_CXXFLAGS has to be after
194 # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden
195 # as the occasion calls for it.
196 AM_CXXFLAGS = \
197 -std=gnu++11 \
198 $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
199 $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \
200 $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS)
201
202 AM_MAKEFLAGS = \
203 "gxx_include_dir=$(gxx_include_dir)"
204
205 # Libtool notes
206
207 # 1) In general, libtool expects an argument such as `--tag=CXX' when
208 # using the C++ compiler, because that will enable the settings
209 # detected when C++ support was being configured. However, when no
210 # such flag is given in the command line, libtool attempts to figure
211 # it out by matching the compiler name in each configuration section
212 # against a prefix of the command line. The problem is that, if the
213 # compiler name and its initial flags stored in the libtool
214 # configuration file don't match those in the command line, libtool
215 # can't decide which configuration to use, and it gives up. The
216 # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe
217 # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to
218 # attempt to infer which configuration to use.
219 #
220 # The second tag argument, `--tag disable-shared` means that libtool
221 # only compiles each source once, for static objects. In actuality,
222 # glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to
223 # the libtool command that is used create the object, which is
224 # suitable for shared libraries. The `--tag disable-shared` must be
225 # placed after --tag CXX lest things CXX undo the affect of
226 # disable-shared.
227
228 # 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is
229 # last. (That way, things like -O2 passed down from the toplevel can
230 # be overridden by --enable-debug.)
231 LTCXXCOMPILE = \
232 $(LIBTOOL) --tag CXX --tag disable-shared \
233 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
234 --mode=compile $(CXX) $(TOPLEVEL_INCLUDES) \
235 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS)
236
237 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
238
239 # 3) We'd have a problem when building the shared libstdc++ object if
240 # the rules automake generates would be used. We cannot allow g++ to
241 # be used since this would add -lstdc++ to the link line which of
242 # course is problematic at this point. So, we get the top-level
243 # directory to configure libstdc++-v3 to use gcc as the C++
244 # compilation driver.
245 CXXLINK = \
246 $(LIBTOOL) --tag CXX --tag disable-shared \
247 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
248 --mode=link $(CXX) \
249 $(VTV_CXXLINKFLAGS) \
250 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) $(LTLDFLAGS) -o $@