make: add defines for leak and undefined sanitize compiler warnings
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 30 Apr 2016 14:16:05 +0000 (16:16 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 30 Apr 2016 17:17:39 +0000 (19:17 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Makefile.inc

index 3a0775f..7767868 100644 (file)
@@ -66,7 +66,9 @@ MUDFLAP ?= 0
 # shows full compiler/linker calls if activated
 VERBOSE ?= 0
 
-SANITIZE_ADDRESS ?= 0
+SANITIZE_ADDRESS   ?= 0
+SANITIZE_LEAK      ?= 0
+SANITIZE_UNDEFINED ?= 0
 
 ifeq ($(VERBOSE),0)
 MAKECMDPREFIX = @
@@ -265,6 +267,14 @@ ifeq ($(OS),linux)
     CFLAGS  += -fsanitize=address -fno-omit-frame-pointer
     LDFLAGS += -fsanitize=address -static-libasan
   endif
+  ifneq ($(SANITIZE_LEAK),0)
+    CFLAGS  += -fsanitize=leak
+    LDFLAGS += -fsanitize=leak -static-liblsan
+  endif
+  ifneq ($(SANITIZE_UNDEFINED),0)
+    CFLAGS  += -fsanitize=undefined
+    LDFLAGS += -fsanitize=undefined -static-libubsan
+  endif
 endif
 
 # extra options from the outside