aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2018-09-10 16:46:59 +1000
committerDavid Gibson <david@gibson.dropbear.id.au>2018-09-10 16:46:59 +1000
commitb94c056b137e59deefc62fbfe0cd3a23edfcc07c (patch)
tree2bce03b8f128958e5c2451c34ed284cbafd5736f /Makefile
parentfd06c54d4711f20d16bb1e18cba4d7bed09e5ad2 (diff)
downloaddtc-b94c056b137e59deefc62fbfe0cd3a23edfcc07c.zip
dtc-b94c056b137e59deefc62fbfe0cd3a23edfcc07c.tar.gz
dtc-b94c056b137e59deefc62fbfe0cd3a23edfcc07c.tar.bz2
Make valgrind optional
Some platforms don't have valgrind support, and sometimes you simply might not want to use valgrind. But at present, dtc, or more specifically its testsuite, won't compile without valgrind because we use the valgrind client interface in some places to improve our testing and suppress false positives. This adds some Makefile detection to correctly handle the case where valgrind is not available. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index d8ebc4f..c4bfae6 100644
--- a/Makefile
+++ b/Makefile
@@ -39,6 +39,13 @@ INCLUDEDIR = $(PREFIX)/include
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]' | \
sed -e 's/\(cygwin\|msys\).*/\1/')
+NO_VALGRIND := $(shell $(PKG_CONFIG) --exists valgrind; echo $$?)
+ifeq ($(NO_VALGRIND),1)
+ CFLAGS += -DNO_VALGRIND
+else
+ CFLAGS += $(shell $(PKG_CONFIG) --cflags valgrind)
+endif
+
ifeq ($(HOSTOS),darwin)
SHAREDLIB_EXT = dylib
SHAREDLIB_CFLAGS = -fPIC