]> git.sur5r.net Git - i3/i3/commitdiff
common.mk: add ASAN flag for AddressSanitizer
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 9 Jan 2016 16:15:33 +0000 (17:15 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 9 Jan 2016 16:15:33 +0000 (17:15 +0100)
See https://github.com/google/sanitizers/wiki for details.
Compile with “make ASAN=1” to enable.

common.mk

index 878aeac10293c3af148e3f9bda91233572f4cc9d..4fe8f2b04cd4a8a654dacc8b30876bc7893ceb72 100644 (file)
--- a/common.mk
+++ b/common.mk
@@ -1,5 +1,6 @@
 UNAME=$(shell uname)
 DEBUG=1
+ASAN=0
 INSTALL=install
 LN=ln
 PKG_CONFIG=pkg-config
@@ -42,6 +43,11 @@ else
 CFLAGS ?= -pipe -O2 -freorder-blocks-and-partition
 endif
 
+ifeq ($(ASAN),1)
+CFLAGS += -fsanitize=address -DI3_ASAN_ENABLED
+LDFLAGS += -fsanitize=address
+endif
+
 # Default LDFLAGS that users should be able to override
 LDFLAGS ?= $(as_needed_LDFLAG)