1# Makefile.am -- Backtrace in libstdc++ Makefile.
2# Copyright (C) 2012-2013 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
32include $(top_srcdir)/fragment.am
33
34toolexeclib_LTLIBRARIES = libstdc++_libbacktrace.la
35
36ACLOCAL_AMFLAGS = -I ../.. -I ../../config
37
38# This will be used instead of the common AM_CPPFLAGS from fragment.am
39libstdc___libbacktrace_la_CPPFLAGS = \
40	-I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
41	-I ../../../libgcc -I .. -I $(top_srcdir) \
42	-I $(top_srcdir)/../libbacktrace \
43	-I $(top_srcdir)/../libiberty \
44	-include $(top_srcdir)/src/libbacktrace/backtrace-rename.h \
45	$(BACKTRACE_CPPFLAGS)
46
47WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
48	     -Wcast-qual
49C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wno-unused-but-set-variable
50CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
51AM_CFLAGS = \
52	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
53	$(C_WARN_FLAGS)
54AM_CFLAGS += $(EXTRA_CFLAGS)
55AM_CXXFLAGS = \
56	$(glibcxx_lt_pic_flag) $(glibcxx_compiler_shared_flag) \
57	$(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
58AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
59
60obj_prefix = std_stacktrace
61
62# Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o
63libstdc___libbacktrace_la_SHORTNAME = $(obj_prefix)
64
65libstdc___libbacktrace_la_SOURCES = \
66	atomic.c \
67	dwarf.c \
68	fileline.c \
69	posix.c \
70	sort.c \
71	simple.c \
72	state.c \
73	cp-demangle.c
74
75FORMAT_FILES = \
76	elf.c \
77	unknown.c
78
79VIEW_FILES = \
80	read.c \
81	mmapio.c
82
83ALLOC_FILES = \
84	alloc.c \
85	mmap.c
86
87EXTRA_libstdc___libbacktrace_la_SOURCES = \
88	$(FORMAT_FILES) \
89	$(VIEW_FILES) \
90	$(ALLOC_FILES)
91
92# These three files are chosen by configure and added to the link.
93# We need the SHORTNAME- prefix so that they use the custom CPPFLAGS above.
94libstdc___libbacktrace_la_LIBADD = \
95	$(obj_prefix)-$(FORMAT_FILE) \
96	$(obj_prefix)-$(VIEW_FILE) \
97	$(obj_prefix)-$(ALLOC_FILE)
98
99libstdc___libbacktrace_la_DEPENDENCIES = $(libstdc___libbacktrace_la_LIBADD)
100
101# Use symlinks for the sources
102
103%.c: ../../../libbacktrace/%.c
104	$(LN_S) $< $@
105
106cp-demangle.c: ../../../libiberty/cp-demangle.c
107	$(LN_S) $< $@
108
109LTCOMPILE = \
110	$(LIBTOOL) --tag CC --tag disable-shared \
111	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
112	--mode=compile $(CC) $(TOPLEVEL_INCLUDES) \
113	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
114
115LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
116
117LINK = \
118	$(LIBTOOL) --tag CC --tag disable-shared \
119	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
120	--mode=link $(CC) \
121	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CFLAGS) $(LTLDFLAGS) -o $@
122