1da0c48c4Sopenharmony_ci## Common automake fragments for elfutils subdirectory makefiles. 2da0c48c4Sopenharmony_ci## 3da0c48c4Sopenharmony_ci## Copyright (C) 2010, 2014, 2016 Red Hat, Inc. 4da0c48c4Sopenharmony_ci## 5da0c48c4Sopenharmony_ci## This file is part of elfutils. 6da0c48c4Sopenharmony_ci## 7da0c48c4Sopenharmony_ci## This file is free software; you can redistribute it and/or modify 8da0c48c4Sopenharmony_ci## it under the terms of either 9da0c48c4Sopenharmony_ci## 10da0c48c4Sopenharmony_ci## * the GNU Lesser General Public License as published by the Free 11da0c48c4Sopenharmony_ci## Software Foundation; either version 3 of the License, or (at 12da0c48c4Sopenharmony_ci## your option) any later version 13da0c48c4Sopenharmony_ci## 14da0c48c4Sopenharmony_ci## or 15da0c48c4Sopenharmony_ci## 16da0c48c4Sopenharmony_ci## * the GNU General Public License as published by the Free 17da0c48c4Sopenharmony_ci## Software Foundation; either version 2 of the License, or (at 18da0c48c4Sopenharmony_ci## your option) any later version 19da0c48c4Sopenharmony_ci## 20da0c48c4Sopenharmony_ci## or both in parallel, as here. 21da0c48c4Sopenharmony_ci## 22da0c48c4Sopenharmony_ci## elfutils is distributed in the hope that it will be useful, but 23da0c48c4Sopenharmony_ci## WITHOUT ANY WARRANTY; without even the implied warranty of 24da0c48c4Sopenharmony_ci## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 25da0c48c4Sopenharmony_ci## General Public License for more details. 26da0c48c4Sopenharmony_ci## 27da0c48c4Sopenharmony_ci## You should have received copies of the GNU General Public License and 28da0c48c4Sopenharmony_ci## the GNU Lesser General Public License along with this program. If 29da0c48c4Sopenharmony_ci## not, see <http://www.gnu.org/licenses/>. 30da0c48c4Sopenharmony_ci## 31da0c48c4Sopenharmony_ci 32da0c48c4Sopenharmony_ciDEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DLOCALEDIR='"${localedir}"' 33da0c48c4Sopenharmony_ciAM_CPPFLAGS = -I. -I$(srcdir) -I$(top_srcdir)/lib -I.. 34da0c48c4Sopenharmony_ci 35da0c48c4Sopenharmony_ci# Drop the 'u' flag that automake adds by default. It is incompatible 36da0c48c4Sopenharmony_ci# with deterministic archives. 37da0c48c4Sopenharmony_ciARFLAGS = cr 38da0c48c4Sopenharmony_ci 39da0c48c4Sopenharmony_ci# Warn about stack usage of more than 256K = 262144 bytes. 40da0c48c4Sopenharmony_ciif ADD_STACK_USAGE_WARNING 41da0c48c4Sopenharmony_ciSTACK_USAGE_WARNING=-Wstack-usage=262144 42da0c48c4Sopenharmony_ciSTACK_USAGE_NO_ERROR=-Wno-error=stack-usage= 43da0c48c4Sopenharmony_cielse 44da0c48c4Sopenharmony_ciSTACK_USAGE_WARNING= 45da0c48c4Sopenharmony_ciSTACK_USAGE_NO_ERROR= 46da0c48c4Sopenharmony_ciendif 47da0c48c4Sopenharmony_ci 48da0c48c4Sopenharmony_ciif SANE_LOGICAL_OP_WARNING 49da0c48c4Sopenharmony_ciLOGICAL_OP_WARNING=-Wlogical-op 50da0c48c4Sopenharmony_cielse 51da0c48c4Sopenharmony_ciLOGICAL_OP_WARNING= 52da0c48c4Sopenharmony_ciendif 53da0c48c4Sopenharmony_ci 54da0c48c4Sopenharmony_ciif HAVE_DUPLICATED_COND_WARNING 55da0c48c4Sopenharmony_ciDUPLICATED_COND_WARNING=-Wduplicated-cond 56da0c48c4Sopenharmony_cielse 57da0c48c4Sopenharmony_ciDUPLICATED_COND_WARNING= 58da0c48c4Sopenharmony_ciendif 59da0c48c4Sopenharmony_ci 60da0c48c4Sopenharmony_ciif HAVE_NULL_DEREFERENCE_WARNING 61da0c48c4Sopenharmony_ciNULL_DEREFERENCE_WARNING=-Wnull-dereference 62da0c48c4Sopenharmony_cielse 63da0c48c4Sopenharmony_ciNULL_DEREFERENCE_WARNING= 64da0c48c4Sopenharmony_ciendif 65da0c48c4Sopenharmony_ci 66da0c48c4Sopenharmony_ciif HAVE_IMPLICIT_FALLTHROUGH_WARNING 67da0c48c4Sopenharmony_ci# Use strict fallthrough. Only __attribute__((fallthrough)) will prevent the 68da0c48c4Sopenharmony_ci# warning 69da0c48c4Sopenharmony_ciif HAVE_IMPLICIT_FALLTHROUGH_5_WARNING 70da0c48c4Sopenharmony_ciIMPLICIT_FALLTHROUGH_WARNING=-Wimplicit-fallthrough=5 71da0c48c4Sopenharmony_cielse 72da0c48c4Sopenharmony_ciIMPLICIT_FALLTHROUGH_WARNING=-Wimplicit-fallthrough 73da0c48c4Sopenharmony_ciendif 74da0c48c4Sopenharmony_cielse 75da0c48c4Sopenharmony_ciIMPLICIT_FALLTHROUGH_WARNING= 76da0c48c4Sopenharmony_ciendif 77da0c48c4Sopenharmony_ci 78da0c48c4Sopenharmony_ciif HAVE_TRAMPOLINES_WARNING 79da0c48c4Sopenharmony_ciTRAMPOLINES_WARNING=-Wtrampolines 80da0c48c4Sopenharmony_cielse 81da0c48c4Sopenharmony_ciTRAMPOLINES_WARNING= 82da0c48c4Sopenharmony_ciendif 83da0c48c4Sopenharmony_ci 84da0c48c4Sopenharmony_ciif HAVE_NO_PACKED_NOT_ALIGNED_WARNING 85da0c48c4Sopenharmony_ciNO_PACKED_NOT_ALIGNED_WARNING=-Wno-packed-not-aligned 86da0c48c4Sopenharmony_cielse 87da0c48c4Sopenharmony_ciNO_PACKED_NOT_ALIGNED_WARNING= 88da0c48c4Sopenharmony_ciendif 89da0c48c4Sopenharmony_ci 90da0c48c4Sopenharmony_ciAM_CFLAGS = -std=gnu99 -Wall -Wshadow -Wformat=2 \ 91da0c48c4Sopenharmony_ci -Wold-style-definition -Wstrict-prototypes $(TRAMPOLINES_WARNING) \ 92da0c48c4Sopenharmony_ci $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ 93da0c48c4Sopenharmony_ci $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ 94da0c48c4Sopenharmony_ci $(if $($(*F)_no_Werror),,-Werror) \ 95da0c48c4Sopenharmony_ci $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ 96da0c48c4Sopenharmony_ci $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ 97da0c48c4Sopenharmony_ci $(if $($(*F)_no_Wpacked_not_aligned),$(NO_PACKED_NOT_ALIGNED_WARNING),) \ 98da0c48c4Sopenharmony_ci $($(*F)_CFLAGS) 99da0c48c4Sopenharmony_ci 100da0c48c4Sopenharmony_ciAM_CXXFLAGS = -std=c++11 -Wall -Wshadow \ 101da0c48c4Sopenharmony_ci $(TRAMPOLINES_WARNING) \ 102da0c48c4Sopenharmony_ci $(LOGICAL_OP_WARNING) $(DUPLICATED_COND_WARNING) \ 103da0c48c4Sopenharmony_ci $(NULL_DEREFERENCE_WARNING) $(IMPLICIT_FALLTHROUGH_WARNING) \ 104da0c48c4Sopenharmony_ci $(if $($(*F)_no_Werror),,-Werror) \ 105da0c48c4Sopenharmony_ci $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ 106da0c48c4Sopenharmony_ci $(if $($(*F)_no_Wstack_usage),,$(STACK_USAGE_WARNING)) \ 107da0c48c4Sopenharmony_ci $(if $($(*F)_no_Wpacked_not_aligned),$(NO_PACKED_NOT_ALIGNED_WARNING),) \ 108da0c48c4Sopenharmony_ci $($(*F)_CXXFLAGS) 109da0c48c4Sopenharmony_ci 110da0c48c4Sopenharmony_ciCOMPILE.os = $(filter-out -fprofile-arcs -ftest-coverage, $(COMPILE)) 111da0c48c4Sopenharmony_ci 112da0c48c4Sopenharmony_ciDEFS.os = -DPIC -DSHARED 113da0c48c4Sopenharmony_ciif SYMBOL_VERSIONING 114da0c48c4Sopenharmony_ciDEFS.os += -DSYMBOL_VERSIONING 115da0c48c4Sopenharmony_cielse 116da0c48c4Sopenharmony_ciendif 117da0c48c4Sopenharmony_ci 118da0c48c4Sopenharmony_ci%.os: %.c %.o 119da0c48c4Sopenharmony_ciif AMDEP 120da0c48c4Sopenharmony_ci $(AM_V_CC)if $(COMPILE.os) -c -o $@ $(fpic_CFLAGS) $(DEFS.os) -MT $@ -MD -MP \ 121da0c48c4Sopenharmony_ci -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \ 122da0c48c4Sopenharmony_ci then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ 123da0c48c4Sopenharmony_ci rm -f "$(DEPDIR)/$*.Tpo"; \ 124da0c48c4Sopenharmony_ci else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ 125da0c48c4Sopenharmony_ci fi 126da0c48c4Sopenharmony_cielse 127da0c48c4Sopenharmony_ci $(AM_V_CC)$(COMPILE.os) -c -o $@ $(fpic_CFLAGS) $(DEFS.os) $< 128da0c48c4Sopenharmony_ciendif 129da0c48c4Sopenharmony_ci 130da0c48c4Sopenharmony_ciCLEANFILES = *.gcno *.gcda 131da0c48c4Sopenharmony_ci 132da0c48c4Sopenharmony_citextrel_msg = echo "WARNING: TEXTREL found in '$@'" 133da0c48c4Sopenharmony_ciif FATAL_TEXTREL 134da0c48c4Sopenharmony_citextrel_found = $(textrel_msg); exit 1 135da0c48c4Sopenharmony_cielse 136da0c48c4Sopenharmony_citextrel_found = $(textrel_msg) 137da0c48c4Sopenharmony_ciendif 138da0c48c4Sopenharmony_citextrel_check = if $(READELF) -d $@ | grep -F -q TEXTREL; then $(textrel_found); fi 139da0c48c4Sopenharmony_ci 140da0c48c4Sopenharmony_ciprint-%: 141da0c48c4Sopenharmony_ci @echo $*=$($*) 142