From a1f1d50d25e92c890e6f28ee37fa66209f258ed2 Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 19 Jun 2019 17:38:36 +0200 Subject: [PATCH] Allow to use compiler's sanitizer. This fixes #53. --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 3ea13e0..484e605 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ RCFLAGS = -O3 -s # Flags to pass to the linker LDFLAGS = +# Flags to enable sanitize checker +SFLAGS = -fsanitize=address -fsanitize=leak -fsanitize=undefined + # Destination directory DESTDIR ?= $(realpath .)/binary @@ -123,6 +126,9 @@ debug: export CFLAGS := $(CFLAGS) $(DCFLAGS) debug: engine sapi modules release: export CFLAGS := $(CFLAGS) $(RCFLAGS) release: engine sapi modules +sanitize: export CFLAGS := $(CFLAGS) $(DCFLAGS) $(SFLAGS) +sanitize: $(eval LDFLAGS := $(LDFLAGS) $(SFLAGS)) +sanitize: engine sapi modules engine: $(ENGINE_OBJS) $(CC) -o $(BUILD_DIR)/lib$(BINARY)$(LIBSUFFIX) $(LDFLAGS) $(LIBS) -shared $(ENGINE_OBJS)