1 # Makefile.am -- Backtrace in libstdc++ Makefile.
2 # Copyright (C) 2012-2025 Free Software Foundation, Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # (1) Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
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
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.
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.
32 include $(top_srcdir)/fragment.am
34 # Convenience library for C++23 runtime.
35 noinst_LTLIBRARIES = libstdc++_libbacktrace.la
37 ACLOCAL_AMFLAGS = -I ../.. -I ../../config
39 # This will be used instead of the common AM_CPPFLAGS from fragment.am
40 libstdc___libbacktrace_la_CPPFLAGS = \
41 -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
42 -I ../../../libgcc -I .. -I $(top_srcdir) \
43 -I $(top_srcdir)/../libbacktrace \
44 -I $(top_srcdir)/../libiberty \
45 -include $(top_srcdir)/src/libbacktrace/backtrace-rename.h \
48 WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
50 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable
51 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
53 $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
54 $(C_WARN_FLAGS) -funwind-tables
55 AM_CFLAGS += $(EXTRA_CFLAGS)
57 $(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
58 $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
59 AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
61 obj_prefix = std_stacktrace
63 # Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o
64 libstdc___libbacktrace_la_SHORTNAME = $(obj_prefix)
66 libstdc___libbacktrace_la_SOURCES = \
90 EXTRA_libstdc___libbacktrace_la_SOURCES = \
95 # These three files are chosen by configure and added to the link.
96 # We need the SHORTNAME- prefix so that they use the custom CPPFLAGS above.
97 libstdc___libbacktrace_la_LIBADD = \
98 $(obj_prefix)-$(FORMAT_FILE) \
99 $(obj_prefix)-$(VIEW_FILE) \
100 $(obj_prefix)-$(ALLOC_FILE)
102 libstdc___libbacktrace_la_DEPENDENCIES = $(libstdc___libbacktrace_la_LIBADD)
104 # Use symlinks for the sources
106 %.c: ../../../libbacktrace/%.c
109 cp-demangle.c: ../../../libiberty/cp-demangle.c
113 $(LIBTOOL) --tag CC --tag disable-shared \
114 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
115 --mode=compile $(CC) $(TOPLEVEL_INCLUDES) \
116 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
118 LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
121 $(LIBTOOL) --tag CC --tag disable-shared \
122 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
124 $(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CFLAGS) $(LTLDFLAGS) -o $@