diff --git a/Makefile b/Makefile index 0eef015..9bc473a 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ # --------------------------------------------------------------------------- DEBUG ?= 0 +NALYZE ?= 0 ASAN ?= 0 STATIC ?= 0 FLTO ?= 0 @@ -22,17 +23,17 @@ SUBDIR_LIB := libslunkcrypt # Flags # --------------------------------------------------------------------------- -CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall -march=$(MARCH) -mtune=$(MTUNE) +CONFIG = LDFLGS = +CFLAGS = -I$(SUBDIR_LIB)/include -std=gnu99 -Wall -march=$(MARCH) -mtune=$(MTUNE) -ifeq ($(DEBUG),1) +ifneq ($(ASAN),0) + CONFIG := _a + CFLAGS += -O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls +else ifneq ($(DEBUG),0) CONFIG := _g CFLAGS += -Og -g -else ifeq ($(ASAN),1) - CONFIG := _a - CFLAGS += -O1 -g -fsanitize=address -fno-omit-frame-pointer else - CONFIG := CFLAGS += -O3 -DNDEBUG ifneq ($(FLTO),0) CFLAGS += -flto -fuse-linker-plugin @@ -41,6 +42,9 @@ ifneq ($(FPGO),0) CFLAGS += -fprofile-$(FPGO) endif endif +ifneq ($(NALYZE),0) + CFLAGS += -fanalyzer +endif MACHINE := $(shell $(CC) -dumpmachine)