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