From 31a66b832990c63308aa1236bd68af242866d3d7 Mon Sep 17 00:00:00 2001 From: Shivesh Mandalia Date: Sun, 17 Apr 2022 16:34:47 +0100 Subject: Add DEBUG flag to control build type --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3e7f9db..9359d29 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,15 @@ BIN_NAME := SRC_DIRS := +# enable debug build +DEBUG = 1 + # general program flags -# Debug -MY_CFLAGS = -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -g -fsanitize=address,undefined -# Release -# MY_CFLAGS = -O3 +ifdef DEBUG + MY_CFLAGS = -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -g -fsanitize=address,undefined +else + MY_CFLAGS = -O3 +endif MY_LIBS = WARNINGS = -fstack-protector-strong -fpie -pedantic -Wall -Wextra @@ -81,7 +85,7 @@ print-%: ; @echo $*=$($*) ## Build everything ##----------------------------------------------------------------------------- -all: format check $(BIN_NAME) +all: $(if $(DEBUG), format check) $(BIN_NAME) ## Static analysis ##----------------------------------------------------------------------------- -- cgit v1.2.3