1 ## Common automake fragments for elfutils subdirectory makefiles.
3 ## Copyright (C) 2010, 2014 Red Hat, Inc.
5 ## This file is part of elfutils.
7 ## This file is free software; you can redistribute it and/or modify
8 ## it under the terms of either
10 ## * the GNU Lesser General Public License as published by the Free
11 ## Software Foundation; either version 3 of the License, or (at
12 ## your option) any later version
16 ## * the GNU General Public License as published by the Free
17 ## Software Foundation; either version 2 of the License, or (at
18 ## your option) any later version
20 ## or both in parallel, as here.
22 ## elfutils is distributed in the hope that it will be useful, but
23 ## WITHOUT ANY WARRANTY; without even the implied warranty of
24 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 ## General Public License for more details.
27 ## You should have received copies of the GNU General Public License and
28 ## the GNU Lesser General Public License along with this program. If
29 ## not, see <http://www.gnu.org/licenses/>.
32 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"'
33 AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I..
35 # Warn about stack usage of more than 256K = 262144 bytes.
36 if ADD_STACK_USAGE_WARNING
37 STACK_USAGE_WARNING=-Wstack-usage=262144
41 AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \
42 -Wold-style-definition -Wstrict-prototypes \
43 $(if $($(*F)_no_Werror),,-Werror) \
44 $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
45 $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \
48 COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE))
50 DEFS.os = -DPIC -DSHARED
52 DEFS.os += -DSYMBOL_VERSIONING
58 if $(COMPILE.os) -c -o $@ -fPIC $(DEFS.os) -MT $@ -MD -MP \
59 -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
60 then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
61 rm -f "$(DEPDIR)/$*.Tpo"; \
62 else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
65 $(COMPILE.os) -c -o $@ -fPIC $(DEFS.os) $<
68 CLEANFILES = *.gcno *.gcda
70 textrel_msg = echo "WARNING: TEXTREL found in '$@'"
72 textrel_found = $(textrel_msg); exit 1
74 textrel_found = $(textrel_msg)
76 textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi