Makefile.am revision 1.1.1.1
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 -Werror
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 = $(C_WARN_FLAGS)
52AM_CFLAGS += $(EXTRA_CFLAGS)
53AM_CXXFLAGS = $(CXX_WARN_FLAGS) -fno-rtti -fno-exceptions
54AM_CXXFLAGS += $(EXTRA_CXXFLAGS)
55
56obj_prefix = std_stacktrace
57
58# Each FILE.c in SOURCES will be compiled to SHORTNAME-FILE.o
59libstdc___libbacktrace_la_SHORTNAME = $(obj_prefix)
60
61libstdc___libbacktrace_la_SOURCES = \
62	atomic.c \
63	dwarf.c \
64	fileline.c \
65	posix.c \
66	sort.c \
67	simple.c \
68	state.c \
69	cp-demangle.c
70
71FORMAT_FILES = \
72	elf.c \
73	unknown.c
74
75VIEW_FILES = \
76	read.c \
77	mmapio.c
78
79ALLOC_FILES = \
80	alloc.c \
81	mmap.c
82
83EXTRA_libstdc___libbacktrace_la_SOURCES = \
84	$(FORMAT_FILES) \
85	$(VIEW_FILES) \
86	$(ALLOC_FILES)
87
88# These three files are chosen by configure and added to the link.
89# We need the SHORTNAME- prefix so that they use the custom CPPFLAGS above.
90libstdc___libbacktrace_la_LIBADD = \
91	$(obj_prefix)-$(FORMAT_FILE) \
92	$(obj_prefix)-$(VIEW_FILE) \
93	$(obj_prefix)-$(ALLOC_FILE)
94
95libstdc___libbacktrace_la_DEPENDENCIES = $(libstdc___libbacktrace_la_LIBADD)
96
97# Use symlinks for the sources
98
99%.c: ../../../libbacktrace/%.c
100	$(LN_S) $< $@
101
102cp-demangle.c: ../../../libiberty/cp-demangle.c
103	$(LN_S) $< $@
104
105LTCOMPILE = \
106	$(LIBTOOL) --tag CC --tag disable-shared \
107	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
108	--mode=compile $(CC) $(TOPLEVEL_INCLUDES) \
109	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
110
111LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/../libtool-ldflags $(LDFLAGS))
112
113LINK = \
114	$(LIBTOOL) --tag CC --tag disable-shared \
115	$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
116	--mode=link $(CC) \
117	$(OPT_LDFLAGS) $(SECTION_LDFLAGS) $(AM_CFLAGS) $(LTLDFLAGS) -o $@
118