commit: 9d0a60f489c17e47e08aa5ec09da8d7049e402ea
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 24 21:19:41 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Aug 24 21:19:41 2015 +0000
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=9d0a60f4
build: add plumbing for building w/debug code
For cases where we want extra debug messages, add some debug knobs.
This will be used in a follow up commit to make it easier to triage
seccomp failures.
Makefile | 8 ++++----
configure.ac | 5 +++++
paxinc.h | 6 ++++++
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 3abfee7..26cc9d4 100644
--- a/Makefile
+++ b/Makefile
@@ -36,10 +36,6 @@ MKDIR := mkdir -p
INS_EXE := install -m755
INS_DATA := install -m644
-# Some fun settings
-#CFLAGS += -DEBUG -g
-#LDFLAGS += -pie
-
PKG_CONFIG ?= pkg-config
ifeq ($(USE_CAP),yes)
@@ -49,6 +45,10 @@ CPPFLAGS-pspax.c += $(LIBCAPS_CFLAGS) -DWANT_SYSCAP
LIBS-pspax += $(LIBCAPS_LIBS)
endif
+ifeq ($(USE_DEBUG),yes)
+override CPPFLAGS += -DEBUG
+endif
+
ifeq ($(USE_SECCOMP),yes)
LIBSECCOMP_CFLAGS := $(shell $(PKG_CONFIG) --cflags libseccomp)
LIBSECCOMP_LIBS := $(shell $(PKG_CONFIG) --libs libseccomp)
diff --git a/configure.ac b/configure.ac
index 327d9b8..3b4de91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,11 @@ AS_IF([test "x$with_caps" = "xyes"], [
LIBS="$LIBS $LIBCAP_LIBS"
])
+AC_ARG_WITH([debug], [AS_HELP_STRING([--with-debug], [enable debug code])])
+AS_IF([test "x$with_debug" = "xyes"], [
+ CPPFLAGS="$CPPFLAGS -DEBUG"
+])
+
AC_ARG_WITH([python], [AS_HELP_STRING([--with-python], [use lddtree.py])])
AM_CONDITIONAL([USE_PYTHON], [test "x$with_python" = "xyes"])
diff --git a/paxinc.h b/paxinc.h
index a8d6d9b..e687b3a 100644
--- a/paxinc.h
+++ b/paxinc.h
@@ -22,6 +22,12 @@
# define VCSID "<unknown>"
#endif
+#ifdef EBUG
+# define USE_DEBUG 1
+#else
+# define USE_DEBUG 0
+#endif
+
/* ELF love */
#include "elf.h"
#include "paxelf.h"