changeset 363:ab53c76f40d5

Add Makefile parameter ASAN to enable address sanitizer build (and disable -O and -flto when doing that.)
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Sep 2020 01:59:35 +0300
parents 5a1c5af0ced1
children f0ad03639a93
files Makefile.gen
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.gen	Wed Aug 26 10:11:14 2020 +0300
+++ b/Makefile.gen	Fri Sep 11 01:59:35 2020 +0300
@@ -1,10 +1,15 @@
 CFLAGS += -W -Wall -Wextra -std=c99 -pedantic -I./ -D_XOPEN_SOURCE=500
 CFLAGS += -g
-CFLAGS += -O2
-#CFLAGS += -flto
 CFLAGS += -DTH_USE_OPT_ARG=1
 THLIBS = th-libs/
 
+ifneq ($(ASAN),)
+CFLAGS += -fsanitize=address
+LDFLAGS += -lasan
+else
+CFLAGS += -O2
+CFLAGS += -flto
+endif
 
 ###
 ### Objects and targets