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