From 9b24550814b7c69065f90039b0a5d0a2281b9f81 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Mon, 21 May 2018 14:25:56 +0100 Subject: [PATCH] Small clean up of the Makefile CFG_DEV is replaced by BUILD_TYPE. Debug build is fixed, set BUILD_TYPE to Debug to make a debug build. Add an option to compile with sanitizers. --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 25e78b1..7d792e2 100644 --- a/Makefile +++ b/Makefile @@ -110,15 +110,16 @@ CFG += -DCOMPTON_VERSION="\"$(COMPTON_VERSION)\"" LDFLAGS ?= -Wl,-O1 -Wl,--as-needed -ifeq "$(CFG_DEV)" "" +BUILD_TYPE ?= "Debug" + +ifeq "$(BUILD_TYPE)" "Release" CFLAGS ?= -DNDEBUG -O2 -D_FORTIFY_SOURCE=2 -else - CC = clang - export LD_ALTEXEC = /usr/bin/ld.gold - OBJS += backtrace-symbols.o - LIBS += -lbfd +else ifeq "$(BUILD_TYPE)" "Debug" CFLAGS += -ggdb -Wshadow - # CFLAGS += -Weverything -Wno-disabled-macro-expansion -Wno-padded -Wno-gnu +endif + +ifeq "$(ENABLE_SAN)" "1" + CFLAGS += -fsanitize=address,undefined endif LIBS += $(shell pkg-config --libs $(PACKAGES))