makefile: Add WARNINGS=ALLOWED make option and change default optimize to -O2
The CI build specifies OPTIMIZE=-O3 and runs with the default where warnings are converted to errors.
This commit is contained in:
parent
009d748ad6
commit
39d33c4cc9
2 changed files with 12 additions and 6 deletions
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
|
@ -32,4 +32,4 @@ jobs:
|
|||
- name: Build
|
||||
env:
|
||||
SIM: ${{matrix.simulators}}
|
||||
run: make LTO=1 $SIM
|
||||
run: make LTO=1 OPTIMIZE=-O3 $SIM
|
||||
|
|
16
makefile
16
makefile
|
@ -50,10 +50,16 @@
|
|||
# the results. Link Time Optimization can report errors which aren't
|
||||
# otherwise detected and will also take significantly longer to
|
||||
# complete. Additionally, non debug builds default to build with an
|
||||
# optimization level of -O3. This optimization level can be changed
|
||||
# by invoking GNU OPTIMIZE=-O2 (or whatever optimize value you want)
|
||||
# optimization level of -O2. This optimization level can be changed
|
||||
# by invoking GNU OPTIMIZE=-O3 (or whatever optimize value you want)
|
||||
# on the command line if desired.
|
||||
#
|
||||
# The default setup will fail simulator build(s) if the compile
|
||||
# produces any warnings. These should be cleaned up before new
|
||||
# or changd code is accepted into the code base. This option
|
||||
# can be overridden if GNU make is invoked with WARNINGS=ALLOWED
|
||||
# on the command line.
|
||||
#
|
||||
# The default build will run per simulator tests if they are
|
||||
# available. If building without running tests is desired,
|
||||
# then GNU make should be invoked with TESTS=0 on the command
|
||||
|
@ -267,7 +273,7 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
|
|||
endif
|
||||
endif
|
||||
else
|
||||
OS_CCDEFS += -Werror
|
||||
OS_CCDEFS += $(if $(findstring ALLOWED,$(WARNINGS)),,-Werror)
|
||||
ifeq (,$(findstring ++,${GCC}))
|
||||
CC_STD = -std=gnu99
|
||||
else
|
||||
|
@ -275,7 +281,7 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
|
|||
endif
|
||||
endif
|
||||
else
|
||||
OS_CCDEFS += -Werror
|
||||
OS_CCDEFS += $(if $(findstring ALLOWED,$(WARNINGS)),,-Werror)
|
||||
ifeq (Apple,$(shell ${GCC} -v /dev/null 2>&1 | grep 'Apple' | awk '{ print $$1 }'))
|
||||
COMPILER_NAME = $(shell ${GCC} -v /dev/null 2>&1 | grep 'Apple' | awk '{ print $$1 " " $$2 " " $$3 " " $$4 }')
|
||||
CLANG_VERSION = $(word 4,$(COMPILER_NAME))
|
||||
|
@ -1266,7 +1272,7 @@ endif
|
|||
ifneq (,$(UNSUPPORTED_BUILD))
|
||||
CFLAGS_GIT += -DSIM_BUILD=Unsupported=$(UNSUPPORTED_BUILD)
|
||||
endif
|
||||
OPTIMIZE ?= -O3
|
||||
OPTIMIZE ?= -O2
|
||||
ifneq ($(DEBUG),)
|
||||
CFLAGS_G = -g -ggdb -g3
|
||||
CFLAGS_O = -O0
|
||||
|
|
Loading…
Add table
Reference in a new issue