From 5a36d090c7e341326399a3f6174e243a941a3029 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 9 Jan 2016 17:15:33 +0100 Subject: [PATCH] common.mk: add ASAN flag for AddressSanitizer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/google/sanitizers/wiki for details. Compile with “make ASAN=1” to enable. --- common.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common.mk b/common.mk index 878aeac1..4fe8f2b0 100644 --- 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)