mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-28 06:53:01 +00:00
Add optimization option to Makefile. (#283)
This commit is contained in:
parent
3bc0b13e20
commit
eac1683754
1 changed files with 33 additions and 9 deletions
42
Makefile
42
Makefile
|
@ -57,6 +57,9 @@ DISCORDRPC ?= 0
|
|||
DISCORD_SDK ?= 1
|
||||
# Enable docker build workarounds
|
||||
DOCKERBUILD ?= 0
|
||||
# Sets your optimization level for building.
|
||||
# A choose is chosen by default for you.
|
||||
OPT_LEVEL ?= -1
|
||||
# Enable compiling with more debug info.
|
||||
DEBUG_INFO_LEVEL ?= 2
|
||||
# Enable profiling
|
||||
|
@ -199,16 +202,37 @@ else ifeq ($(VERSION),sh)
|
|||
endif
|
||||
|
||||
# Determine our optimization level.
|
||||
ifeq ($(DEBUG),0)
|
||||
# Can't use O2 or higher right now for auto-builders, coop-compiler produces strange graphical errors
|
||||
# likely due to undefined behavior somewhere
|
||||
#ifeq ($(WINDOWS_AUTO_BUILDER),1)
|
||||
# OPT_FLAGS := -O1
|
||||
#else
|
||||
OPT_FLAGS := -O2
|
||||
#endif
|
||||
else
|
||||
# Optimization Levels 0 through 5 optimize for speed,
|
||||
# While optimization levels 6, and 7 optimize for size.
|
||||
# If no optimization is specified, A default is chosen.
|
||||
ifeq ($(OPT_LEVEL),0) # No optimization
|
||||
OPT_FLAGS := -O0
|
||||
else ifeq ($(OPT_LEVEL),1) # Debugging optimization
|
||||
OPT_FLAGS := -Og
|
||||
else ifeq ($(OPT_LEVEL),2) # Level 1 Optimization
|
||||
OPT_FLAGS := -O1
|
||||
else ifeq ($(OPT_LEVEL),3) # Level 2 Optimization
|
||||
OPT_FLAGS := -O2
|
||||
else ifeq ($(OPT_LEVEL),4) # Level 3 Optimization
|
||||
OPT_FLAGS := -O3
|
||||
else ifeq ($(OPT_LEVEL),5) # Fastest Optimization
|
||||
OPT_FLAGS := -Ofast
|
||||
else ifeq ($(OPT_LEVEL),6) # Size Optimization
|
||||
OPT_FLAGS := -Os
|
||||
else ifeq ($(OPT_LEVEL),7) # Aggresive Size Optimization
|
||||
OPT_FLAGS := -Oz
|
||||
else
|
||||
ifeq ($(DEBUG),0)
|
||||
# Can't use O2 or higher right now for auto-builders, coop-compiler produces strange graphical errors
|
||||
# likely due to undefined behavior somewhere
|
||||
#ifeq ($(WINDOWS_AUTO_BUILDER),1)
|
||||
# OPT_FLAGS := -O1
|
||||
#else
|
||||
OPT_FLAGS := -O2
|
||||
#endif
|
||||
else
|
||||
OPT_FLAGS := -O0
|
||||
endif
|
||||
endif
|
||||
|
||||
# Set our level of debug symbol info,
|
||||
|
|
Loading…
Reference in a new issue