]>
Commit | Line | Data |
---|---|---|
63a4b106 AB |
1 | # Makefile.am -- Backtrace Makefile. |
2 | # Copyright (C) 2012-2021 Free Software Foundation, Inc. | |
3 | ||
4 | # Redistribution and use in source and binary forms, with or without | |
5 | # modification, are permitted provided that the following conditions are | |
6 | # met: | |
7 | ||
8 | # (1) Redistributions of source code must retain the above copyright | |
9 | # notice, this list of conditions and the following disclaimer. | |
10 | ||
11 | # (2) Redistributions in binary form must reproduce the above copyright | |
12 | # notice, this list of conditions and the following disclaimer in | |
13 | # the documentation and/or other materials provided with the | |
14 | # distribution. | |
15 | ||
16 | # (3) The name of the author may not be used to | |
17 | # endorse or promote products derived from this software without | |
18 | # specific prior written permission. | |
19 | ||
20 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
21 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
22 | # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
23 | # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
24 | # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
25 | # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
26 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
28 | # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
29 | # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | # POSSIBILITY OF SUCH DAMAGE. | |
31 | ||
32 | ACLOCAL_AMFLAGS = -I .. -I ../config | |
33 | ||
34 | AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \ | |
35 | -I ../libgcc | |
36 | ||
37 | AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG) $(CET_HOST_FLAGS) | |
38 | ||
39 | noinst_LTLIBRARIES = libbacktrace.la | |
40 | ||
41 | libbacktrace_la_SOURCES = \ | |
42 | backtrace.h \ | |
43 | atomic.c \ | |
44 | dwarf.c \ | |
45 | fileline.c \ | |
46 | internal.h \ | |
47 | posix.c \ | |
48 | print.c \ | |
49 | sort.c \ | |
50 | state.c | |
51 | ||
52 | BACKTRACE_FILES = \ | |
53 | backtrace.c \ | |
54 | simple.c \ | |
55 | nounwind.c | |
56 | ||
57 | FORMAT_FILES = \ | |
58 | elf.c \ | |
59 | macho.c \ | |
60 | pecoff.c \ | |
61 | unknown.c \ | |
62 | xcoff.c | |
63 | ||
64 | VIEW_FILES = \ | |
65 | read.c \ | |
66 | mmapio.c | |
67 | ||
68 | ALLOC_FILES = \ | |
69 | alloc.c \ | |
70 | mmap.c | |
71 | ||
72 | EXTRA_libbacktrace_la_SOURCES = \ | |
73 | $(BACKTRACE_FILES) \ | |
74 | $(FORMAT_FILES) \ | |
75 | $(VIEW_FILES) \ | |
76 | $(ALLOC_FILES) | |
77 | ||
78 | libbacktrace_la_LIBADD = \ | |
79 | $(BACKTRACE_FILE) \ | |
80 | $(FORMAT_FILE) \ | |
81 | $(VIEW_FILE) \ | |
82 | $(ALLOC_FILE) | |
83 | ||
84 | libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD) | |
85 | ||
86 | # Testsuite. | |
87 | ||
88 | # Add a test to this variable if you want it to be built. | |
89 | check_PROGRAMS = | |
90 | ||
91 | # Add a test to this variable if you want it to be run. | |
92 | TESTS = | |
93 | ||
94 | # Add a test to this variable if you want it to be built and run. | |
95 | BUILDTESTS = | |
96 | ||
97 | # Add a file to this variable if you want it to be built for testing. | |
98 | check_DATA = | |
99 | ||
100 | # Flags to use when compiling test programs. | |
101 | libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g | |
102 | ||
103 | if USE_DSYMUTIL | |
104 | ||
105 | %.dSYM: % | |
106 | $(DSYMUTIL) $< | |
107 | ||
108 | endif USE_DSYMUTIL | |
109 | ||
110 | if NATIVE | |
111 | check_LTLIBRARIES = libbacktrace_alloc.la | |
112 | ||
113 | libbacktrace_alloc_la_SOURCES = $(libbacktrace_la_SOURCES) | |
114 | libbacktrace_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) read.lo alloc.lo | |
115 | ||
116 | libbacktrace_alloc_la_DEPENDENCIES = $(libbacktrace_alloc_la_LIBADD) | |
117 | ||
118 | check_LTLIBRARIES += libbacktrace_noformat.la | |
119 | ||
120 | libbacktrace_noformat_la_SOURCES = $(libbacktrace_la_SOURCES) | |
121 | libbacktrace_noformat_la_LIBADD = $(BACKTRACE_FILE) $(VIEW_FILE) $(ALLOC_FILE) | |
122 | ||
123 | libbacktrace_noformat_la_DEPENDENCIES = $(libbacktrace_noformat_la_LIBADD) | |
124 | ||
125 | if HAVE_ELF | |
126 | if HAVE_OBJCOPY_DEBUGLINK | |
127 | ||
128 | TEST_BUILD_ID_DIR=$(abs_builddir)/usr/lib/debug/.build-id/ | |
129 | ||
130 | check_LTLIBRARIES += libbacktrace_elf_for_test.la | |
131 | ||
132 | libbacktrace_elf_for_test_la_SOURCES = $(libbacktrace_la_SOURCES) | |
133 | libbacktrace_elf_for_test_la_LIBADD = $(BACKTRACE_FILE) elf_for_test.lo \ | |
134 | $(VIEW_FILE) $(ALLOC_FILE) | |
135 | ||
136 | elf_for_test.c: elf.c | |
137 | SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \ | |
138 | REPLACE="#define SYSTEM_BUILD_ID_DIR \"$(TEST_BUILD_ID_DIR)\""; \ | |
139 | $(SED) "s%$$SEARCH%$$REPLACE%" \ | |
140 | $< \ | |
141 | > $@.tmp | |
142 | mv $@.tmp $@ | |
143 | ||
144 | endif HAVE_OBJCOPY_DEBUGLINK | |
145 | endif HAVE_ELF | |
146 | ||
147 | elf_%.c: elf.c | |
148 | SEARCH='#error "Unknown BACKTRACE_ELF_SIZE"'; \ | |
149 | REPLACE='#undef BACKTRACE_ELF_SIZE\ | |
150 | #define BACKTRACE_ELF_SIZE'; \ | |
151 | $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ | |
152 | $< \ | |
153 | > $@.tmp | |
154 | mv $@.tmp $@ | |
155 | ||
156 | xcoff_%.c: xcoff.c | |
157 | SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \ | |
158 | REPLACE='#undef BACKTRACE_XCOFF_SIZE\ | |
159 | #define BACKTRACE_XCOFF_SIZE'; \ | |
160 | $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ | |
161 | $< \ | |
162 | > $@.tmp | |
163 | mv $@.tmp $@ | |
164 | ||
165 | test_elf_32_SOURCES = test_format.c testlib.c | |
166 | test_elf_32_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
167 | test_elf_32_LDADD = libbacktrace_noformat.la elf_32.lo | |
168 | ||
169 | BUILDTESTS += test_elf_32 | |
170 | ||
171 | test_elf_64_SOURCES = test_format.c testlib.c | |
172 | test_elf_64_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
173 | test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo | |
174 | ||
175 | BUILDTESTS += test_elf_64 | |
176 | ||
177 | test_macho_SOURCES = test_format.c testlib.c | |
178 | test_macho_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
179 | test_macho_LDADD = libbacktrace_noformat.la macho.lo | |
180 | ||
181 | BUILDTESTS += test_macho | |
182 | ||
183 | test_xcoff_32_SOURCES = test_format.c testlib.c | |
184 | test_xcoff_32_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
185 | test_xcoff_32_LDADD = libbacktrace_noformat.la xcoff_32.lo | |
186 | ||
187 | BUILDTESTS += test_xcoff_32 | |
188 | ||
189 | test_xcoff_64_SOURCES = test_format.c testlib.c | |
190 | test_xcoff_64_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
191 | test_xcoff_64_LDADD = libbacktrace_noformat.la xcoff_64.lo | |
192 | ||
193 | BUILDTESTS += test_xcoff_64 | |
194 | ||
195 | test_pecoff_SOURCES = test_format.c testlib.c | |
196 | test_pecoff_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
197 | test_pecoff_LDADD = libbacktrace_noformat.la pecoff.lo | |
198 | ||
199 | BUILDTESTS += test_pecoff | |
200 | ||
201 | test_unknown_SOURCES = test_format.c testlib.c | |
202 | test_unknown_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
203 | test_unknown_LDADD = libbacktrace_noformat.la unknown.lo | |
204 | ||
205 | BUILDTESTS += test_unknown | |
206 | ||
207 | unittest_SOURCES = unittest.c testlib.c | |
208 | unittest_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
209 | unittest_LDADD = libbacktrace.la | |
210 | ||
211 | BUILDTESTS += unittest | |
212 | ||
213 | unittest_alloc_SOURCES = $(unittest_SOURCES) | |
214 | unittest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
215 | unittest_alloc_LDADD = libbacktrace_alloc.la | |
216 | ||
217 | BUILDTESTS += unittest_alloc | |
218 | ||
219 | check_LTLIBRARIES += libbacktrace_instrumented_alloc.la | |
220 | ||
221 | libbacktrace_instrumented_alloc_la_SOURCES = $(libbacktrace_la_SOURCES) | |
222 | libbacktrace_instrumented_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) \ | |
223 | read.lo instrumented_alloc.lo | |
224 | ||
225 | libbacktrace_instrumented_alloc_la_DEPENDENCIES = \ | |
226 | $(libbacktrace_instrumented_alloc_la_LIBADD) | |
227 | ||
228 | instrumented_alloc.lo: alloc.c | |
229 | ||
230 | allocfail_SOURCES = allocfail.c testlib.c | |
231 | allocfail_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
232 | allocfail_LDADD = libbacktrace_instrumented_alloc.la | |
233 | ||
234 | check_PROGRAMS += allocfail | |
235 | ||
236 | allocfail.sh: allocfail | |
237 | ||
238 | TESTS += allocfail.sh | |
239 | ||
240 | if USE_DSYMUTIL | |
241 | check_DATA += allocfail.dSYM | |
242 | endif USE_DSYMUTIL | |
243 | ||
244 | if HAVE_ELF | |
245 | if HAVE_OBJCOPY_DEBUGLINK | |
246 | ||
247 | b2test_SOURCES = $(btest_SOURCES) | |
248 | b2test_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
249 | b2test_LDFLAGS = -Wl,--build-id | |
250 | b2test_LDADD = libbacktrace_elf_for_test.la | |
251 | ||
252 | check_PROGRAMS += b2test | |
253 | TESTS += b2test_buildid | |
254 | ||
255 | if HAVE_DWZ | |
256 | ||
257 | b3test_SOURCES = $(btest_SOURCES) | |
258 | b3test_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
259 | b3test_LDFLAGS = -Wl,--build-id | |
260 | b3test_LDADD = libbacktrace_elf_for_test.la | |
261 | ||
262 | check_PROGRAMS += b3test | |
263 | TESTS += b3test_dwz_buildid | |
264 | ||
265 | endif HAVE_DWZ | |
266 | ||
267 | endif HAVE_OBJCOPY_DEBUGLINK | |
268 | endif HAVE_ELF | |
269 | ||
270 | btest_SOURCES = btest.c testlib.c | |
271 | btest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O | |
272 | btest_LDADD = libbacktrace.la | |
273 | ||
274 | BUILDTESTS += btest | |
275 | ||
276 | if USE_DSYMUTIL | |
277 | check_DATA += btest.dSYM | |
278 | endif USE_DSYMUTIL | |
279 | ||
280 | if HAVE_ELF | |
281 | ||
282 | btest_lto_SOURCES = btest.c testlib.c | |
283 | btest_lto_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O -flto | |
284 | btest_lto_LDADD = libbacktrace.la | |
285 | ||
286 | BUILDTESTS += btest_lto | |
287 | ||
288 | endif HAVE_ELF | |
289 | ||
290 | btest_alloc_SOURCES = $(btest_SOURCES) | |
291 | btest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
292 | btest_alloc_LDADD = libbacktrace_alloc.la | |
293 | ||
294 | BUILDTESTS += btest_alloc | |
295 | ||
296 | if USE_DSYMUTIL | |
297 | check_DATA += btest_alloc.dSYM | |
298 | endif USE_DSYMUTIL | |
299 | ||
300 | if HAVE_DWZ | |
301 | ||
302 | %_dwz: % | |
303 | rm -f $@ $@_common.debug | |
304 | cp $< $@_1 | |
305 | cp $< $@_2 | |
306 | if $(DWZ) -m $@_common.debug $@_1 $@_2; then \ | |
307 | rm -f $@_2; \ | |
308 | mv $@_1 $@; \ | |
309 | else \ | |
310 | echo "Ignoring dwz errors, assuming that test passes"; \ | |
311 | cp $< $@; \ | |
312 | fi | |
313 | ||
314 | TESTS += btest_dwz | |
315 | ||
316 | if HAVE_OBJCOPY_DEBUGLINK | |
317 | ||
318 | TESTS += btest_dwz_gnudebuglink | |
319 | ||
320 | endif HAVE_OBJCOPY_DEBUGLINK | |
321 | ||
322 | endif HAVE_DWZ | |
323 | ||
324 | stest_SOURCES = stest.c | |
325 | stest_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
326 | stest_LDADD = libbacktrace.la | |
327 | ||
328 | BUILDTESTS += stest | |
329 | ||
330 | if USE_DSYMUTIL | |
331 | check_DATA += stest.dSYM | |
332 | endif USE_DSYMUTIL | |
333 | ||
334 | stest_alloc_SOURCES = $(stest_SOURCES) | |
335 | stest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
336 | stest_alloc_LDADD = libbacktrace_alloc.la | |
337 | ||
338 | BUILDTESTS += stest_alloc | |
339 | ||
340 | if USE_DSYMUTIL | |
341 | check_DATA += stest_alloc.dSYM | |
342 | endif USE_DSYMUTIL | |
343 | ||
344 | if HAVE_ELF | |
345 | ||
346 | ztest_SOURCES = ztest.c testlib.c | |
347 | ztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" | |
348 | ztest_LDADD = libbacktrace.la | |
349 | ztest_alloc_LDADD = libbacktrace_alloc.la | |
350 | ||
351 | if HAVE_ZLIB | |
352 | ztest_LDADD += -lz | |
353 | ztest_alloc_LDADD += -lz | |
354 | endif | |
355 | ztest_LDADD += $(CLOCK_GETTIME_LINK) | |
356 | ztest_alloc_LDADD += $(CLOCK_GETTIME_LINK) | |
357 | ||
358 | BUILDTESTS += ztest | |
359 | ||
360 | ztest_alloc_SOURCES = $(ztest_SOURCES) | |
361 | ztest_alloc_CFLAGS = $(ztest_CFLAGS) | |
362 | ||
363 | BUILDTESTS += ztest_alloc | |
364 | ||
365 | endif HAVE_ELF | |
366 | ||
367 | edtest_SOURCES = edtest.c edtest2_build.c testlib.c | |
368 | edtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
369 | edtest_LDADD = libbacktrace.la | |
370 | ||
371 | BUILDTESTS += edtest | |
372 | ||
373 | if USE_DSYMUTIL | |
374 | check_DATA += edtest.dSYM | |
375 | endif USE_DSYMUTIL | |
376 | ||
377 | edtest_alloc_SOURCES = $(edtest_SOURCES) | |
378 | edtest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
379 | edtest_alloc_LDADD = libbacktrace_alloc.la | |
380 | ||
381 | if USE_DSYMUTIL | |
382 | check_DATA += edtest_alloc.dSYM | |
383 | endif USE_DSYMUTIL | |
384 | ||
385 | BUILDTESTS += edtest_alloc | |
386 | ||
387 | edtest2_build.c: gen_edtest2_build; @true | |
388 | gen_edtest2_build: $(srcdir)/edtest2.c | |
389 | cat $(srcdir)/edtest2.c > tmp-edtest2_build.c | |
390 | $(SHELL) $(srcdir)/../move-if-change tmp-edtest2_build.c edtest2_build.c | |
391 | echo timestamp > $@ | |
392 | ||
393 | if HAVE_PTHREAD | |
394 | ||
395 | BUILDTESTS += ttest | |
396 | ||
397 | ttest_SOURCES = ttest.c testlib.c | |
398 | ttest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -pthread | |
399 | ttest_LDADD = libbacktrace.la | |
400 | ||
401 | if USE_DSYMUTIL | |
402 | check_DATA += ttest.dSYM | |
403 | endif USE_DSYMUTIL | |
404 | ||
405 | BUILDTESTS += ttest_alloc | |
406 | ||
407 | ttest_alloc_SOURCES = $(ttest_SOURCES) | |
408 | ttest_alloc_CFLAGS = $(ttest_CFLAGS) | |
409 | ttest_alloc_LDADD = libbacktrace_alloc.la | |
410 | ||
411 | if USE_DSYMUTIL | |
412 | check_DATA += ttest_alloc.dSYM | |
413 | endif USE_DSYMUTIL | |
414 | ||
415 | endif HAVE_PTHREAD | |
416 | ||
417 | if HAVE_OBJCOPY_DEBUGLINK | |
418 | ||
419 | TESTS += btest_gnudebuglink | |
420 | ||
421 | %_gnudebuglink: % | |
422 | $(OBJCOPY) --only-keep-debug $< $@.debug | |
423 | $(OBJCOPY) --strip-debug --add-gnu-debuglink=$@.debug $< $@ | |
424 | ||
425 | endif HAVE_OBJCOPY_DEBUGLINK | |
426 | ||
427 | %_buildid: % | |
428 | ./install-debuginfo-for-buildid.sh \ | |
429 | "$(TEST_BUILD_ID_DIR)" \ | |
430 | $< | |
431 | $(OBJCOPY) --strip-debug $< $@ | |
432 | ||
433 | if HAVE_COMPRESSED_DEBUG | |
434 | ||
435 | ctestg_SOURCES = btest.c testlib.c | |
436 | ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
437 | ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu | |
438 | ctestg_LDADD = libbacktrace.la | |
439 | ||
440 | ctesta_SOURCES = btest.c testlib.c | |
441 | ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS) | |
442 | ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi | |
443 | ctesta_LDADD = libbacktrace.la | |
444 | ||
445 | BUILDTESTS += ctestg ctesta | |
446 | ||
447 | ctestg_alloc_SOURCES = $(ctestg_SOURCES) | |
448 | ctestg_alloc_CFLAGS = $(ctestg_CFLAGS) | |
449 | ctestg_alloc_LDFLAGS = $(ctestg_LDFLAGS) | |
450 | ctestg_alloc_LDADD = libbacktrace_alloc.la | |
451 | ||
452 | ctesta_alloc_SOURCES = $(ctesta_SOURCES) | |
453 | ctesta_alloc_CFLAGS = $(ctesta_CFLAGS) | |
454 | ctesta_alloc_LDFLAGS = $(ctesta_LDFLAGS) | |
455 | ctesta_alloc_LDADD = libbacktrace_alloc.la | |
456 | ||
457 | BUILDTESTS += ctestg_alloc ctesta_alloc | |
458 | ||
459 | endif | |
460 | ||
461 | if HAVE_DWARF5 | |
462 | ||
463 | dwarf5_SOURCES = btest.c testlib.c | |
464 | dwarf5_CFLAGS = $(libbacktrace_TEST_CFLAGS) -gdwarf-5 | |
465 | dwarf5_LDADD = libbacktrace.la | |
466 | ||
467 | BUILDTESTS += dwarf5 | |
468 | ||
469 | if USE_DSYMUTIL | |
470 | check_DATA += dwarf5.dSYM | |
471 | endif USE_DSYMUTIL | |
472 | ||
473 | dwarf5_alloc_SOURCES = $(dwarf5_SOURCES) | |
474 | dwarf5_alloc_CFLAGS = $(dwarf5_CFLAGS) | |
475 | dwarf5_alloc_LDADD = libbacktrace_alloc.la | |
476 | ||
477 | BUILDTESTS += dwarf5_alloc | |
478 | ||
479 | if USE_DSYMUTIL | |
480 | check_DATA += dwarf5_alloc.dSYM | |
481 | endif USE_DSYMUTIL | |
482 | ||
483 | endif | |
484 | ||
485 | mtest_SOURCES = mtest.c testlib.c | |
486 | mtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O | |
487 | mtest_LDADD = libbacktrace.la | |
488 | ||
489 | BUILDTESTS += mtest | |
490 | ||
491 | if USE_DSYMUTIL | |
492 | check_DATA += mtest.dSYM | |
493 | endif USE_DSYMUTIL | |
494 | ||
495 | if HAVE_MINIDEBUG | |
496 | ||
497 | TESTS += mtest_minidebug | |
498 | ||
499 | %_minidebug: % | |
500 | $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms | |
501 | $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms | |
502 | $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms | |
503 | $(OBJCOPY) --only-keep-debug $< $<.dbg | |
504 | $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg | |
505 | $(OBJCOPY) --strip-all --remove-section ..comment $< $<.strip | |
506 | rm -f $<.mdbg.xz | |
507 | $(XZ) $<.mdbg | |
508 | $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg.xz $<.strip | |
509 | mv $<.strip $@ | |
510 | ||
511 | endif HAVE_MINIDEBUG | |
512 | ||
513 | endif NATIVE | |
514 | ||
515 | if HAVE_ELF | |
516 | ||
517 | xztest_SOURCES = xztest.c testlib.c | |
518 | xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\" | |
519 | xztest_LDADD = libbacktrace.la | |
520 | ||
521 | xztest_alloc_SOURCES = $(xztest_SOURCES) | |
522 | xztest_alloc_CFLAGS = $(xztest_CFLAGS) | |
523 | xztest_alloc_LDADD = libbacktrace_alloc.la | |
524 | ||
525 | if HAVE_LIBLZMA | |
526 | xztest_LDADD += -llzma | |
527 | xztest_alloc_LDADD += -llzma | |
528 | endif | |
529 | ||
530 | xztest_LDADD += $(CLOCK_GETTIME_LINK) | |
531 | xztest_alloc_LDADD += $(CLOCK_GETTIME_LINK) | |
532 | ||
533 | BUILDTESTS += xztest xztest_alloc | |
534 | ||
535 | endif HAVE_ELF | |
536 | ||
537 | check_PROGRAMS += $(BUILDTESTS) | |
538 | ||
539 | TESTS += $(BUILDTESTS) | |
540 | ||
541 | CLEANFILES = \ | |
542 | $(TESTS) *.debug elf_for_test.c edtest2_build.c gen_edtest2_build \ | |
543 | *.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip | |
544 | ||
545 | clean-local: | |
546 | -rm -rf usr | |
547 | ||
548 | # We can't use automake's automatic dependency tracking, because it | |
549 | # breaks when using bootstrap-lean. Automatic dependency tracking | |
550 | # with GCC bootstrap will cause some of the objects to depend on | |
551 | # header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When | |
552 | # using bootstrap-lean, prev-gcc is removed after each stage. When | |
553 | # running "make install", those header files will be gone, causing the | |
554 | # library to be rebuilt at install time. That may not succeed. | |
555 | ||
556 | # These manual dependencies do not include dependencies on unwind.h, | |
557 | # even though that is part of GCC, because where to find it depends on | |
558 | # whether we are being built as a host library or a target library. | |
559 | ||
560 | INCDIR = $(top_srcdir)/../include | |
561 | alloc.lo: config.h backtrace.h internal.h | |
562 | backtrace.lo: config.h backtrace.h internal.h | |
563 | btest.lo: $(INCDIR)/filenames.h backtrace.h backtrace-supported.h | |
564 | dwarf.lo: config.h $(INCDIR)/dwarf2.h $(INCDIR)/dwarf2.def \ | |
565 | $(INCDIR)/filenames.h backtrace.h internal.h | |
566 | elf.lo: config.h backtrace.h internal.h | |
567 | fileline.lo: config.h backtrace.h internal.h | |
568 | macho.lo: config.h backtrace.h internal.h | |
569 | mmap.lo: config.h backtrace.h internal.h | |
570 | mmapio.lo: config.h backtrace.h internal.h | |
571 | mtest.lo: backtrace.h backtrace-supported.h | |
572 | nounwind.lo: config.h internal.h | |
573 | pecoff.lo: config.h backtrace.h internal.h | |
574 | posix.lo: config.h backtrace.h internal.h | |
575 | print.lo: config.h backtrace.h internal.h | |
576 | read.lo: config.h backtrace.h internal.h | |
577 | simple.lo: config.h backtrace.h internal.h | |
578 | sort.lo: config.h backtrace.h internal.h | |
579 | stest.lo: config.h backtrace.h internal.h | |
580 | state.lo: config.h backtrace.h backtrace-supported.h internal.h | |
581 | unknown.lo: config.h backtrace.h internal.h | |
582 | xcoff.lo: config.h backtrace.h internal.h | |
583 | xztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h | |
584 | ztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h | |
585 | ||
586 | include $(top_srcdir)/../multilib.am |