Makefile: Build debug builds with -Og instead of -O0 where available.

git-svn-id: https://svn.eduke32.com/eduke32@6631 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-01-30 16:02:24 +00:00
parent 874b7df3aa
commit c64bfef4f1

View file

@ -222,6 +222,18 @@ endif
CLANG_POTENTIAL_VERSION := $(shell $(CCFULLPATH) --version)
ifeq ($(findstring clang,$(CLANG_POTENTIAL_VERSION)),clang)
override CLANG := 1
ifeq ($(findstring Apple,$(CLANG_POTENTIAL_VERSION)),Apple)
override APPLE_CLANG := 1
APPLE_CLANG_VER := $(word 4,$(CLANG_POTENTIAL_VERSION))
override APPLE_CLANG_VER_SPLIT := $(subst ., ,$(APPLE_CLANG_VER))
APPLE_CLANG_MAJOR := $(word 1,$(APPLE_CLANG_VER_SPLIT))
APPLE_CLANG_MINOR := $(word 2,$(APPLE_CLANG_VER_SPLIT))
else
CLANG_VER := $(word 3,$(CLANG_POTENTIAL_VERSION))
override CLANG_VER_SPLIT := $(subst ., ,$(CLANG_VER))
CLANG_MAJOR := $(word 1,$(CLANG_VER_SPLIT))
CLANG_MINOR := $(word 2,$(CLANG_VER_SPLIT))
endif
endif
ifneq (0,$(CLANG))
@ -391,6 +403,29 @@ endif
ifeq ($(RELEASE),0)
OPTLEVEL := 0
# see if we can use -Og
ifeq (1,$(APPLE_CLANG))
# Apple clang >= 9.0
ifeq (,$(filter 0 1 2 3 4 5 6 7 8,$(APPLE_CLANG_MAJOR)))
OPTLEVEL := g
endif
else ifeq (1,$(CLANG))
# clang >= 4.0
ifeq (,$(filter 0 1 2 3,$(CLANG_MAJOR)))
OPTLEVEL := g
endif
else
# GCC >= 4.8
ifeq (,$(filter 0 1 2 3 4,$(GCC_MAJOR)))
OPTLEVEL := g
else ifeq (4,$(GCC_MAJOR))
ifeq (,$(filter 0 1 2 3 4 5 6 7,$(GCC_MINOR)))
OPTLEVEL := g
endif
endif
endif
LTO := 0
else
OPTLEVEL := 2