Makefiles: allow overriding the optimization level with debugging builds.

git-svn-id: https://svn.eduke32.com/eduke32@3725 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-05-04 16:36:10 +00:00
parent d56e5451d9
commit 6deabcdb5d
2 changed files with 10 additions and 5 deletions

View File

@ -163,10 +163,16 @@ DISABLEINLINING?=0
FORCEWARNINGS?=0
EFENCE?=0
DMALLOC?=0
OPTLEVEL?=2
PROFILER?=0
MUDFLAP?=0
# Select the default optimization level for release and debug builds.
ifeq ($RELEASE,0)
OPTLEVEL?=0
else
OPTLEVEL?=2
endif
ifeq ($(RELEASE),0)
override STRIP=
endif
@ -311,9 +317,10 @@ ifneq ($(RELEASE)$(DEBUGANYWAY),10)
endif
endif
debug+= -O$(OPTLEVEL)
ifneq (0,$(RELEASE))
# Debugging disabled
debug+= -O$(OPTLEVEL)
ifeq (0,$(CLANG))
debug+= -funswitch-loops
ifeq (1,$(strip $(shell expr $(GCC_MAJOR) \< 4)))
@ -336,8 +343,6 @@ ifneq (0,$(RELEASE))
endif
else
# Debugging enabled
debug+= -O0
ifeq (0,$(DEBUGANYWAY))
debug+= -DDEBUGGINGAIDS
else

View File

@ -290,7 +290,7 @@ $(OBJ)/%.$o: $(SRC)/%.nasm
# Comment out the following rule to debug a-c.o
$(OBJ)/a-c.$o: $(SRC)/a-c.c
$(COMPILE_STATUS)
if $(COMPILER) $(subst -O0,-O2,$(subst -fsanitize=address -fsanitize=undefined,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
if $(COMPILER) $(subst -O$(OPTLEVEL),-O2,$(subst -fsanitize=address -fsanitize=undefined,,$(OURCFLAGS))) -c $< -o $@; then $(COMPILE_OK); else $(COMPILE_FAILED); fi
# KEEPINSYNC the Clang -f option(s) with Makefile.common
$(OBJ)/%.$o: $(SRC)/%.c