summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-08-10 09:38:46 +0200
committerTobias Klauser <tklauser@distanz.ch>2016-08-10 09:38:46 +0200
commitcb158d929bdb417af3b6fdc8fa39bc9a76068793 (patch)
tree9911fbef83ade8d62587df5026179fd00ca4fe43 /Makefile
parent66cf8073cb31cebf4532afec9b18556aff8088fb (diff)
build: Disable all optimization options for debug builds
Disable all optimizations with the GCC -O0 switch. Only explicitely enable additional optimization options for non-debug builds. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile18
1 files changed, 10 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 7ace9e9..83454e2 100644
--- a/Makefile
+++ b/Makefile
@@ -66,10 +66,19 @@ endif
# make CFLAGS="<flags>"
CFLAGS_DEF = -std=gnu99
CFLAGS_DEF += -pipe
-CFLAGS_DEF += -O2
ifeq ($(DEBUG), 1)
CFLAGS_DEF += -g
+ CFLAGS_DEF += -O0
+ CFLAGS_DEF += -fno-omit-frame-pointer
+else
+ CFLAGS_DEF += -O2
+ CFLAGS_DEF += -fomit-frame-pointer
+ CFLAGS_DEF += -fno-strict-aliasing
+ CFLAGS_DEF += -fasynchronous-unwind-tables
+ ifneq ($(COMPILER), clang)
+ CFLAGS_DEF += -fno-delete-null-pointer-checks
+ endif
endif
ifeq ($(HARDENING), 1)
@@ -83,13 +92,6 @@ ifeq ($(HARDENING), 1)
CFLAGS_DEF += -fexceptions
endif
-CFLAGS_DEF += -fomit-frame-pointer
-CFLAGS_DEF += -fno-strict-aliasing
-CFLAGS_DEF += -fasynchronous-unwind-tables
-ifneq ($(COMPILER), clang)
-CFLAGS_DEF += -fno-delete-null-pointer-checks
-endif
-
CFLAGS_MIN = -D_REENTRANT
CFLAGS_MIN += -D_LARGEFILE_SOURCE
CFLAGS_MIN += -D_LARGEFILE64_SOURCE