aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2013-04-10 21:48:35 +0000
committerMike Frysinger <vapier@gentoo.org>2013-04-10 21:48:35 +0000
commita68951848f0b3816e6d4b3861c1e0810ae1383fe (patch)
tree57e7cb8be5e6c0abbf3a8b704d1d9b5e533514d1 /Makefile
parentfix typo in call -- check_gcc vs check-gcc (diff)
downloadpax-utils-a68951848f0b3816e6d4b3861c1e0810ae1383fe.tar.gz
pax-utils-a68951848f0b3816e6d4b3861c1e0810ae1383fe.tar.bz2
pax-utils-a68951848f0b3816e6d4b3861c1e0810ae1383fe.zip
add a new check_gcc_many to check a bunch of flags at once, and add new asan flag when debugging
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile22
1 files changed, 14 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 4062103..234578a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,25 @@
# Copyright 2003-2006 Ned Ludd <solar@linbsd.net>
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-projects/pax-utils/Makefile,v 1.81 2013/04/10 21:42:52 vapier Exp $
+# $Header: /var/cvsroot/gentoo-projects/pax-utils/Makefile,v 1.82 2013/04/10 21:48:35 vapier Exp $
####################################################################
check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi)
+check_gcc_many = $(foreach flag,$(1),$(call check_gcc,$(flag)))
####################################################################
# Avoid CC overhead when installing
ifneq ($(MAKECMDGOALS),install)
+_WFLAGS := \
+ -Wdeclaration-after-statement \
+ -Wextra \
+ -Wsequence-point \
+ -Wstrict-overflow
WFLAGS := -Wall -Wunused -Wimplicit -Wshadow -Wformat=2 \
-Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \
-Wbad-function-cast -Wnested-externs -Wcomment -Winline \
-Wchar-subscripts -Wcast-align -Wno-format-nonliteral \
- $(call check_gcc,-Wdeclaration-after-statement) \
- $(call check_gcc,-Wsequence-point) \
- $(call check_gcc,-Wstrict-overflow) \
- $(call check_gcc,-Wextra)
+ $(call check_gcc_many,$(_WFLAGS))
endif
CFLAGS ?= -O2 -pipe
@@ -61,10 +64,13 @@ SOURCES = $(OBJS:%.o=%.c)
all: $(OBJS) $(TARGETS)
@:
+DEBUG_FLAGS = \
+ -nopie \
+ -fsanitize=address
debug: clean
- $(MAKE) CFLAGS="$(CFLAGS) -g3 -ggdb $(call check_gcc,-nopie)" all
- @-/sbin/chpax -permsx $(ELF_TARGETS)
- @-/sbin/paxctl -permsx $(ELF_TARGETS)
+ $(MAKE) CFLAGS="$(CFLAGS) -g3 -ggdb $(call check_gcc_many,$(DEBUG_FLAGS))" all
+ @-chpax -permsx $(ELF_TARGETS)
+ @-paxctl -permsx $(ELF_TARGETS)
compile.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(CPPFLAGS-$<) -o $@ -c $<