From cb158d929bdb417af3b6fdc8fa39bc9a76068793 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 10 Aug 2016 09:38:46 +0200 Subject: 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 --- Makefile | 18 ++++++++++-------- 1 file 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="" 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 -- cgit v1.2.3-54-g00ecf