]>
Commit | Line | Data |
---|---|---|
8bae34da | 1 | ## Makefile for the C++11 sources of the GNU C++ Standard library. |
b2dad0e3 | 2 | ## |
83ffe9cd | 3 | ## Copyright (C) 1997-2023 Free Software Foundation, Inc. |
b2dad0e3 BK |
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 | |
748086b7 | 11 | ## Free Software Foundation; either version 3, or (at your option) |
b2dad0e3 BK |
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 | |
748086b7 JJ |
20 | ## with this library; see the file COPYING3. If not see |
21 | ## <http://www.gnu.org/licenses/>. | |
b2dad0e3 | 22 | |
0df3f383 | 23 | include $(top_srcdir)/fragment.am |
ae9dc931 | 24 | |
fb8e29a5 | 25 | if GLIBCXX_HOSTED |
0ca7ba9a JW |
26 | if ENABLE_FILESYSTEM_TS |
27 | filesystem_dir = filesystem | |
28 | else | |
29 | filesystem_dir = | |
30 | endif | |
31 | ||
3acb929c JW |
32 | if ENABLE_BACKTRACE |
33 | backtrace_dir = libbacktrace | |
34 | else | |
35 | backtrace_dir = | |
36 | endif | |
37 | ||
fb8e29a5 JW |
38 | experimental_dir = experimental |
39 | else | |
40 | filesystem_dir = | |
41 | backtrace_dir = | |
42 | experimental_dir = | |
43 | endif | |
44 | ||
a9d49e96 | 45 | ## Keep this list sync'd with acinclude.m4:GLIBCXX_CONFIGURE. |
fb8e29a5 | 46 | SUBDIRS = c++98 c++11 c++17 c++20 $(filesystem_dir) $(backtrace_dir) $(experimental_dir) |
8bae34da | 47 | |
714e9334 | 48 | # Cross compiler support. |
f7f049fa CT |
49 | if VTV_CYGMIN |
50 | toolexeclib_LTLIBRARIES = libvtv.la libstdc++.la | |
51 | else | |
b2dad0e3 | 52 | toolexeclib_LTLIBRARIES = libstdc++.la |
f7f049fa CT |
53 | endif |
54 | ||
55 | if VTV_CYGMIN | |
56 | vtv_stubs.cc: | |
57 | rm -f $@ | |
58 | $(LN_S) $(toplevel_srcdir)/libstdc++-v3/libsupc++/vtv_stubs.cc $@ | |
59 | ||
60 | libvtv_la_SOURCES = vtv_stubs.cc | |
61 | libvtv_la_LDFLAGS = $(lt_host_flags) | |
62 | ||
63 | libvtv_la_AM_CXXFLAGS = \ | |
64 | $(glibcxx_compiler_pic_flag) \ | |
65 | $(XTEMPLATE_FLAGS) \ | |
66 | -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end \ | |
67 | $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) | |
68 | ||
69 | libvtv_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ | |
70 | $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libvtv_la_AM_CXXFLAGS) \ | |
71 | $(CXXFLAGS) $(libvtv_la_LDFLAGS) $(LDFLAGS) -o $@ | |
72 | endif | |
b2dad0e3 | 73 | |
0b284728 BK |
74 | vpath % $(top_srcdir)/src/c++98 |
75 | vpath % $(top_srcdir)/src/c++11 | |
dfaa3c47 | 76 | vpath % $(top_srcdir)/src/c++17 |
a0e4d7b4 | 77 | vpath % $(top_srcdir)/src/c++20 |
0ca7ba9a JW |
78 | if ENABLE_FILESYSTEM_TS |
79 | vpath % $(top_srcdir)/src/filesystem | |
80 | endif | |
3acb929c JW |
81 | if ENABLE_BACKTRACE |
82 | vpath % $(top_srcdir)/src/libbacktrace | |
83 | endif | |
ea63396f | 84 | vpath % $(top_srcdir)/src/experimental |
8bae34da | 85 | |
0b284728 BK |
86 | if GLIBCXX_LDBL_COMPAT |
87 | ldbl_compat_sources = compatibility-ldbl.cc | |
88 | else | |
89 | ldbl_compat_sources = | |
90 | endif | |
91 | ||
7c1e7eed JW |
92 | if GLIBCXX_LDBL_ALT128_COMPAT |
93 | if ENABLE_DUAL_ABI | |
94 | ldbl_alt128_compat_cxx11_sources = \ | |
95 | compatibility-ldbl-alt128-cxx11.cc | |
96 | else | |
97 | ldbl_alt128_compat_cxx11_sources = | |
98 | endif | |
99 | ldbl_alt128_compat_sources = \ | |
100 | compatibility-ldbl-alt128.cc \ | |
101 | ${ldbl_alt128_compat_cxx11_sources} | |
102 | else | |
103 | ldbl_alt128_compat_sources = | |
104 | endif | |
105 | ||
357d6fcd JW |
106 | if ENABLE_SYMVERS_GNU_NAMESPACE |
107 | cxx0x_compat_sources = | |
108 | else | |
109 | cxx0x_compat_sources = \ | |
110 | compatibility-atomic-c++0x.cc \ | |
111 | compatibility-c++0x.cc \ | |
112 | compatibility-chrono.cc \ | |
113 | compatibility-condvar.cc \ | |
114 | compatibility-thread-c++0x.cc | |
115 | endif | |
495de4f4 | 116 | |
0b284728 BK |
117 | parallel_compat_sources = \ |
118 | compatibility-parallel_list.cc compatibility-parallel_list-2.cc | |
495de4f4 | 119 | |
0b284728 BK |
120 | |
121 | cxx98_sources = \ | |
122 | compatibility.cc \ | |
123 | compatibility-debug_list.cc \ | |
124 | compatibility-debug_list-2.cc \ | |
f92ab29f | 125 | ${ldbl_compat_sources} |
0b284728 BK |
126 | |
127 | cxx11_sources = \ | |
357d6fcd | 128 | ${cxx0x_compat_sources} \ |
7c1e7eed | 129 | ${ldbl_alt128_compat_sources} |
0b284728 BK |
130 | |
131 | libstdc___la_SOURCES = $(cxx98_sources) $(cxx11_sources) | |
8bae34da BK |
132 | |
133 | libstdc___la_LIBADD = \ | |
134 | $(GLIBCXX_LIBS) \ | |
135 | $(top_builddir)/libsupc++/libsupc++convenience.la \ | |
136 | $(top_builddir)/src/c++98/libc++98convenience.la \ | |
dfaa3c47 | 137 | $(top_builddir)/src/c++11/libc++11convenience.la \ |
a0e4d7b4 TR |
138 | $(top_builddir)/src/c++17/libc++17convenience.la \ |
139 | $(top_builddir)/src/c++20/libc++20convenience.la | |
8bae34da BK |
140 | |
141 | libstdc___la_DEPENDENCIES = \ | |
142 | ${version_dep} \ | |
143 | $(top_builddir)/libsupc++/libsupc++convenience.la \ | |
144 | $(top_builddir)/src/c++98/libc++98convenience.la \ | |
dfaa3c47 | 145 | $(top_builddir)/src/c++11/libc++11convenience.la \ |
a0e4d7b4 TR |
146 | $(top_builddir)/src/c++17/libc++17convenience.la \ |
147 | $(top_builddir)/src/c++20/libc++20convenience.la | |
8bae34da BK |
148 | |
149 | libstdc___la_LDFLAGS = \ | |
150 | -version-info $(libtool_VERSION) ${version_arg} -lm | |
151 | ||
08fca4df | 152 | libstdc___la_LINK = $(CXXLINK) $(libstdc___la_LDFLAGS) $(lt_host_flags) |
8bae34da | 153 | |
0b284728 | 154 | # Use special rules for compatibility-ldbl.cc compilation, as we need to |
7c1e7eed | 155 | # pass -mlong-double-64, and not use -mabi={ieee,ibm}longdouble. |
0b284728 | 156 | if GLIBCXX_LDBL_COMPAT |
7c1e7eed JW |
157 | if GLIBCXX_LDBL_ALT128_COMPAT |
158 | LTCXXCOMPILE64 = \ | |
159 | $(filter-out -mabi=ieeelongdouble -mabi=ibmlongdouble,$(LTCXXCOMPILE)) | |
160 | CXXCOMPILE64 = \ | |
161 | $(filter-out -mabi=ieeelongdouble -mabi=ibmlongdouble,$(CXXCOMPILE)) | |
162 | else | |
163 | LTCXXCOMPILE64 = $(LTCXXCOMPILE) | |
164 | CXXCOMPILE64 = $(CXXCOMPILE) | |
165 | endif | |
0b284728 | 166 | compatibility-ldbl.lo: compatibility-ldbl.cc |
7c1e7eed | 167 | $(LTCXXCOMPILE64) $(LONG_DOUBLE_COMPAT_FLAGS) -c $< |
0b284728 | 168 | compatibility-ldbl.o: compatibility-ldbl.cc |
7c1e7eed JW |
169 | $(CXXCOMPILE64) $(LONG_DOUBLE_COMPAT_FLAGS) -c $< |
170 | endif | |
171 | ||
172 | # Use special rules for compatibility-ldbl-alt128.cc compilation, as we need to | |
173 | # ensure it is compiled with the correct flag. | |
174 | if GLIBCXX_LDBL_ALT128_COMPAT | |
175 | compatibility-ldbl-alt128.lo: compatibility-ldbl-alt128.cc | |
176 | $(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $< | |
177 | compatibility-ldbl-alt128.o: compatibility-ldbl-alt128.cc | |
178 | $(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $< | |
179 | if ENABLE_DUAL_ABI | |
180 | compatibility-ldbl-alt128-cxx11.lo: compatibility-ldbl-alt128-cxx11.cc | |
181 | $(LTCXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $< | |
182 | compatibility-ldbl-alt128-cxx11.o: compatibility-ldbl-alt128-cxx11.cc | |
183 | $(CXXCOMPILE) $(LONG_DOUBLE_ALT128_COMPAT_FLAGS) -std=gnu++11 -c $< | |
184 | endif | |
0b284728 BK |
185 | endif |
186 | ||
187 | # Use special rules for C++11 files/objects. | |
188 | compatibility-c++0x.lo: compatibility-c++0x.cc | |
189 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
190 | compatibility-c++0x.o: compatibility-c++0x.cc | |
191 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
192 | ||
193 | compatibility-atomic-c++0x.lo: compatibility-atomic-c++0x.cc | |
194 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
195 | compatibility-atomic-c++0x.o: compatibility-atomic-c++0x.cc | |
196 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
197 | ||
198 | compatibility-thread-c++0x.lo: compatibility-thread-c++0x.cc | |
199 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
200 | compatibility-thread-c++0x.o: compatibility-thread-c++0x.cc | |
201 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
202 | ||
2e8a9734 JJ |
203 | compatibility-chrono.lo: compatibility-chrono.cc |
204 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
205 | compatibility-chrono.o: compatibility-chrono.cc | |
206 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
207 | ||
3429db0f JW |
208 | compatibility-condvar.lo: compatibility-condvar.cc |
209 | $(LTCXXCOMPILE) -std=gnu++11 -c $< | |
210 | compatibility-condvar.o: compatibility-condvar.cc | |
211 | $(CXXCOMPILE) -std=gnu++11 -c $< | |
212 | ||
ac6d1200 | 213 | # A note on compatibility and static libraries. |
f92ab29f | 214 | # |
ac6d1200 BK |
215 | # static lib == linked against only this version, should not need compat |
216 | # shared lib == linked against potentially all compat versions | |
217 | # | |
218 | # Thus, the shared libs have more compat symbols, which can be found | |
219 | # segregated in the sources with -D_GLIBCXX_SHARED. | |
220 | # | |
dfaa3c47 | 221 | # In the sub-directories of libsupc++, src/c++98, src/c++11, src/c++17, |
a0e4d7b4 TR |
222 | # src/c++20, only -prefer-pic objects are generated for the convenience |
223 | # libraries. | |
f92ab29f | 224 | # |
ac6d1200 BK |
225 | # In the main src directory, make shared and static objects just for |
226 | # the compat libraries. Shared objects are compiled with -prefer-pic | |
227 | # -D_GLIBCXX_SHARED and in the .libs sub-directory, static objects are | |
228 | # compiled with -prefer-pic (ie, -fPIC but not -D_GLIBCXX_SHARED) and | |
229 | # the main src directory. | |
230 | # | |
231 | # Why are objects destined for libstdc++.a compiled with -fPIC? First, | |
232 | # because -fPIC is not harmful to use for objects destined for static | |
233 | # libraries. In addition, using -fPIC will allow the use of static | |
234 | # libstdc++.a in the creation of other C++ shared libraries. | |
235 | ||
236 | # AM_CXXFLAGS needs to be in each sub-directory so that it can be | |
8bae34da BK |
237 | # modified in a per-library or per-sub-library way. Need to manually |
238 | # set this option because CONFIG_CXXFLAGS has to be after | |
239 | # OPTIMIZE_CXXFLAGS on the compile line so that -O2 can be overridden | |
240 | # as the occasion calls for it. | |
c2be8205 | 241 | AM_CXXFLAGS_PRE = \ |
6cd9cb89 | 242 | -std=gnu++98 \ |
ac6d1200 | 243 | $(glibcxx_compiler_pic_flag) \ |
2077db1b | 244 | $(XTEMPLATE_FLAGS) $(VTV_CXXFLAGS) \ |
0b284728 | 245 | $(WARN_CXXFLAGS) $(OPTIMIZE_CXXFLAGS) $(CONFIG_CXXFLAGS) |
8bae34da | 246 | |
c2be8205 CT |
247 | AM_CXXFLAGS = $(filter-out -fvtable-verify=std,$(AM_CXXFLAGS_PRE)) |
248 | ||
0b284728 | 249 | # Libtool notes |
8bae34da | 250 | |
ac6d1200 | 251 | # 1) In general, libtool expects an argument such as `--tag=CXX' when |
8bae34da BK |
252 | # using the C++ compiler, because that will enable the settings |
253 | # detected when C++ support was being configured. However, when no | |
254 | # such flag is given in the command line, libtool attempts to figure | |
255 | # it out by matching the compiler name in each configuration section | |
256 | # against a prefix of the command line. The problem is that, if the | |
257 | # compiler name and its initial flags stored in the libtool | |
258 | # configuration file don't match those in the command line, libtool | |
259 | # can't decide which configuration to use, and it gives up. The | |
260 | # correct solution is to add `--tag CXX' to LTCXXCOMPILE and maybe | |
261 | # CXXLINK, just after $(LIBTOOL), so that libtool doesn't have to | |
ac6d1200 | 262 | # attempt to infer which configuration to use. |
f92ab29f | 263 | # |
ac6d1200 BK |
264 | # The second tag argument, `--tag disable-shared` means that libtool |
265 | # only compiles each source once, for static objects. In actuality, | |
266 | # glibcxx_lt_pic_flag and glibcxx_compiler_shared_flag are added to | |
267 | # the libtool command that is used create the object, which is | |
268 | # suitable for shared libraries. The `--tag disable-shared` must be | |
269 | # placed after --tag CXX lest things CXX undo the affect of | |
270 | # disable-shared. | |
271 | ||
b1d6986c | 272 | # 2) Need to explicitly set LTCXXCOMPILE so that EXTRA_CXX_FLAGS is |
ac6d1200 | 273 | # last. (That way, things like -O2 passed down from the toplevel can |
b1d6986c | 274 | # be overridden by --enable-debug and --enable-cxx-flags.) |
0b284728 BK |
275 | LTCXXCOMPILE = \ |
276 | $(LIBTOOL) --tag CXX \ | |
277 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ | |
278 | --mode=compile $(CXX) $(INCLUDES) \ | |
b1d6986c | 279 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(EXTRA_CXX_FLAGS) |
8bae34da BK |
280 | |
281 | LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS)) | |
282 | ||
283 | # 3) We'd have a problem when building the shared libstdc++ object if | |
284 | # the rules automake generates would be used. We cannot allow g++ to | |
285 | # be used since this would add -lstdc++ to the link line which of | |
286 | # course is problematic at this point. So, we get the top-level | |
287 | # directory to configure libstdc++-v3 to use gcc as the C++ | |
288 | # compilation driver. | |
0b284728 BK |
289 | CXXLINK = \ |
290 | $(LIBTOOL) --tag CXX \ | |
291 | $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ | |
292 | --mode=link $(CXX) \ | |
2077db1b | 293 | $(VTV_CXXLINKFLAGS) \ |
c644b7df JW |
294 | $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CXXFLAGS) \ |
295 | $(LTLDFLAGS) $(LTLIBICONV) \ | |
296 | -o $@ | |
0b284728 | 297 | |
6aa43d99 | 298 | # Symbol versioning for shared libraries. |
fb5c309d BK |
299 | if ENABLE_SYMVERS |
300 | libstdc++-symbols.ver: ${glibcxx_srcdir}/$(SYMVER_FILE) \ | |
f9314d01 | 301 | $(port_specific_symbol_files) |
cc2de92d RO |
302 | cp ${glibcxx_srcdir}/$(SYMVER_FILE) $@.tmp |
303 | chmod +w $@.tmp | |
0df3f383 | 304 | if test "x$(port_specific_symbol_files)" != x; then \ |
6defecc2 | 305 | if grep '^# Appended to version file.' \ |
49a52ebc | 306 | $(port_specific_symbol_files) > /dev/null 2>&1; then \ |
cc2de92d | 307 | cat $(port_specific_symbol_files) >> $@.tmp; \ |
6defecc2 | 308 | else \ |
cc2de92d RO |
309 | sed -n '1,/DO NOT DELETE/p' $@.tmp > tmp.top; \ |
310 | sed -n '/DO NOT DELETE/,$$p' $@.tmp > tmp.bottom; \ | |
311 | cat tmp.top $(port_specific_symbol_files) tmp.bottom > $@.tmp; \ | |
6defecc2 JJ |
312 | rm tmp.top tmp.bottom; \ |
313 | fi; \ | |
e6b7a69a | 314 | fi |
9396206b | 315 | $(EGREP) -v '^[ ]*#(#| |$$)' $@.tmp | \ |
d392c399 | 316 | $(CC) -E -P -include $(CONFIG_HEADER) - > $@ || (rm -f $@ ; exit 1) |
cc2de92d | 317 | rm -f $@.tmp |
f9314d01 | 318 | |
c18dc5cc RO |
319 | CLEANFILES = libstdc++-symbols.ver |
320 | ||
f9314d01 | 321 | if ENABLE_SYMVERS_GNU |
fb5c309d BK |
322 | version_arg = -Wl,--version-script=libstdc++-symbols.ver |
323 | version_dep = libstdc++-symbols.ver | |
324 | endif | |
3cbc7af0 BK |
325 | if ENABLE_SYMVERS_GNU_NAMESPACE |
326 | version_arg = -Wl,--version-script=libstdc++-symbols.ver | |
327 | version_dep = libstdc++-symbols.ver | |
328 | endif | |
c18dc5cc RO |
329 | if ENABLE_SYMVERS_SUN |
330 | version_arg = -Wl,-M,libstdc++-symbols.ver-sun | |
331 | version_dep = libstdc++-symbols.ver-sun | |
332 | libstdc++-symbols.ver-sun : libstdc++-symbols.ver \ | |
333 | $(toplevel_srcdir)/contrib/make_sunver.pl \ | |
334 | $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) | |
335 | CXXFILT="$(CXXFILT)"; export CXXFILT; \ | |
336 | perl $(toplevel_srcdir)/contrib/make_sunver.pl \ | |
337 | libstdc++-symbols.ver \ | |
338 | $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ | |
b2099e9f JW |
339 | `echo ' $(libstdc___la_LIBADD) ' | \ |
340 | sed -e 's,/\([^/.]*\)\.la,/.libs/\1.a,g' -e 's/ -l[^ ]* / /'` \ | |
c18dc5cc RO |
341 | > $@ || (rm -f $@ ; exit 1) |
342 | endif | |
fb5c309d BK |
343 | if ENABLE_SYMVERS_DARWIN |
344 | version_arg = -Wl,-exported_symbols_list,libstdc++-symbols.explist | |
345 | version_dep = libstdc++-symbols.explist | |
346 | libstdc++-symbols.explist : libstdc++-symbols.ver \ | |
a9fdd472 GK |
347 | ${glibcxx_srcdir}/scripts/make_exports.pl \ |
348 | $(libstdc___la_OBJECTS) $(libstdc___la_LIBADD) | |
349 | perl ${glibcxx_srcdir}/scripts/make_exports.pl \ | |
fb5c309d | 350 | libstdc++-symbols.ver \ |
a9fdd472 GK |
351 | $(libstdc___la_OBJECTS:%.lo=.libs/%.o) \ |
352 | `echo $(libstdc___la_LIBADD) | \ | |
353 | sed 's,/\([^/.]*\)\.la,/.libs/\1.a,g'` \ | |
354 | > $@ || (rm -f $@ ; exit 1) | |
fb5c309d | 355 | endif |
c18dc5cc RO |
356 | |
357 | CLEANFILES += $(version_dep) | |
a9fdd472 | 358 | else |
6aa43d99 | 359 | version_arg = |
7b865c36 | 360 | version_dep = |
6aa43d99 BK |
361 | endif |
362 | ||
56378d0e BK |
363 | |
364 | # Control additional build primary rules. | |
56378d0e BK |
365 | all-once: libstdc++convenience.la $(STAMP_DEBUG) |
366 | install-data-once: $(STAMP_INSTALL_DEBUG) | |
367 | ||
368 | all-local: all-once | |
369 | install-data-local: install-data-once | |
370 | clean-local: | |
371 | rm -rf libstdc++convenience.la stamp* $(CLEAN_DEBUG) | |
6aa43d99 | 372 | |
8bae34da BK |
373 | # Make a non-installed convenience library, so that --disable-static |
374 | # may work. | |
375 | libstdc++convenience.la: $(toolexeclib_LTLIBRARIES) | |
376 | $(CXXLINK) $(libstdc___la_LIBADD) $(LIBS); \ | |
377 | if test ! -f .libs/libstdc++.a; then \ | |
a7a790e9 BK |
378 | cp .libs/libstdc++convenience.a .libs/libstdc++.a; \ |
379 | fi; \ | |
ba755148 | 380 | date > stamp-libstdc++convenience; |
8bae34da | 381 | |
56378d0e BK |
382 | # Added rules. |
383 | # 1 debug library | |
384 | # 2 supra-convenience library | |
385 | if GLIBCXX_BUILD_DEBUG | |
386 | STAMP_DEBUG = build-debug | |
387 | STAMP_INSTALL_DEBUG = install-debug | |
388 | CLEAN_DEBUG = debug | |
389 | else | |
390 | STAMP_DEBUG = | |
391 | STAMP_INSTALL_DEBUG = | |
392 | CLEAN_DEBUG = | |
393 | endif | |
6aa43d99 | 394 | |
56378d0e | 395 | # Build a debug variant. |
ba755148 | 396 | |
8d03ad01 | 397 | # Take care to fix all possibly-relative paths. |
ba755148 JW |
398 | debug/%/Makefile: %/Makefile |
399 | $(MKDIR_P) $(dir $@) | |
400 | sed -e 's/top_builddir = \.\./top_builddir = ..\/../' \ | |
401 | -e 's/top_build_prefix = \.\./top_build_prefix = ..\/../' \ | |
402 | -e 's/srcdir = \.\./srcdir = ..\/../' \ | |
403 | -e 's/VPATH = \.\./VPATH = ..\/../' \ | |
404 | -e 's/glibcxx_basedir = \.\./glibcxx_basedir = ..\/../' \ | |
405 | -e 's/MKDIR_P = \.\./MKDIR_P = ..\/../' \ | |
406 | < $< > $@ | |
407 | ||
408 | stamp-debug: $(foreach dir,. $(SUBDIRS),debug/$(dir)/Makefile) | |
409 | mv debug/Makefile debug/Makefile.tmp | |
410 | sed -e 's,all-local: all-once,all-local:,' \ | |
411 | -e 's,install-data-local: install-data-once,install-data-local:,' \ | |
412 | -e '/vpath/!s,src/c,src/debug/c,' \ | |
413 | < debug/Makefile.tmp > debug/Makefile | |
414 | rm -f debug/Makefile.tmp | |
415 | date > stamp-debug; | |
416 | ||
417 | .SECONDARY: $(foreach dir,. $(SUBDIRS),debug/$(dir)/Makefile) | |
6aa43d99 | 418 | |
6a26ad67 | 419 | if ENABLE_BACKTRACE |
ba755148 JW |
420 | backtrace_supported_h = $(backtrace_dir)/backtrace-supported.h |
421 | debug_backtrace_supported_h = debug/$(backtrace_supported_h) | |
422 | $(debug_backtrace_supported_h): $(backtrace_supported_h) stamp-debug | |
6a26ad67 | 423 | cp $< $@ |
6a26ad67 JW |
424 | else |
425 | debug_backtrace_supported_h = | |
426 | endif | |
427 | ||
428 | build-debug: stamp-debug $(debug_backtrace_supported_h) | |
ba755148 JW |
429 | $(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \ |
430 | toolexeclibdir=$(glibcxx_toolexeclibdir)/debug all | |
56378d0e BK |
431 | |
432 | # Install debug library. | |
433 | install-debug: build-debug | |
3c672179 BRF |
434 | $(MAKE) -C debug CXXFLAGS='$(DEBUG_FLAGS)' \ |
435 | toolexeclibdir=$(glibcxx_toolexeclibdir)/debug install |