summaryrefslogtreecommitdiff
path: root/src/Makefile
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2018-12-19 19:31:04 +1100
committerMaxime Coste <mawww@kakoune.org>2018-12-19 19:31:04 +1100
commit1a280e91c726ce193c5fdebca030cc3ecbb86685 (patch)
tree505f9b45ff0e9241609b047d5bc28dd1d646cf79 /src/Makefile
parentef3419edbf2d8c06aecceb6504ea499172983346 (diff)
Add support for 'sanitizers=...' make option
Use make sanitizers=undefined,address to enable undefined and address sanitizers. Closes #2596
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
index c44be63e..8bb56d9b 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,6 +20,21 @@ else
endif
endif
+ifneq (,$(findstring address,$(sanitize)))
+ CPPFLAGS += -fsanitize=address
+ LDFLAGS += -lasan
+ sanitize_suffix := $(sanitize_suffix)a
+endif
+ifneq (,$(findstring undefined,$(sanitize)))
+ CPPFLAGS += -fsanitize=undefined
+ LDFLAGS += -lubsan
+ sanitize_suffix := $(sanitize_suffix)u
+endif
+
+ifneq (,$(sanitize_suffix))
+ suffix := $(suffix).san_$(sanitize_suffix)
+endif
+
version ?= $(shell if [ -f .version ]; then cat .version; elif [ -d ../.git ]; then git describe --tags HEAD; else echo "unknown"; fi)
sources := $(sort $(wildcard *.cc))