Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 1 | ## Common automake fragments for elfutils subdirectory makefiles. |
| 2 | ## |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 3 | ## Copyright (C) 2010, 2014 Red Hat, Inc. |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 4 | ## |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 5 | ## This file is part of elfutils. |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 6 | ## |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 7 | ## This file is free software; you can redistribute it and/or modify |
| 8 | ## it under the terms of either |
| 9 | ## |
| 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 |
| 13 | ## |
| 14 | ## or |
| 15 | ## |
| 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 |
| 19 | ## |
| 20 | ## or both in parallel, as here. |
| 21 | ## |
| 22 | ## elfutils is distributed in the hope that it will be useful, but |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 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. |
| 26 | ## |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 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/>. |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 30 | ## |
| 31 | |
| 32 | DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 33 | AM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. |
| 34 | AM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 35 | $(if $($(*F)_no_Werror),,-Werror) \ |
| 36 | $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 37 | $($(*F)_CFLAGS) |
| 38 | |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 39 | COMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE)) |
Ben Cheng | 25b3c04 | 2013-11-20 14:45:36 -0800 | [diff] [blame] | 40 | |
| 41 | %.os: %.c %.o |
| 42 | if AMDEP |
| 43 | if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \ |
| 44 | -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ |
| 45 | then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ |
| 46 | rm -f "$(DEPDIR)/$*.Tpo"; \ |
| 47 | else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ |
| 48 | fi |
| 49 | else |
| 50 | $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED $< |
| 51 | endif |
| 52 | |
| 53 | CLEANFILES = *.gcno *.gcda |
| 54 | |
Elliott Hughes | 0333382 | 2015-02-18 22:19:45 -0800 | [diff] [blame^] | 55 | textrel_msg = echo "WARNING: TEXTREL found in '$@'" |
| 56 | if FATAL_TEXTREL |
| 57 | textrel_found = $(textrel_msg); exit 1 |
| 58 | else |
| 59 | textrel_found = $(textrel_msg) |
| 60 | endif |
| 61 | textrel_check = if $(READELF) -d $@ | fgrep -q TEXTREL; then $(textrel_found); fi |