1
0
mirror of https://github.com/simh/simh.git synced 2026-01-11 23:52:58 +00:00

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:
Mark Pizzolato 2022-11-02 12:19:55 -10:00
parent ab096a8f7e
commit 4e8b24cabc
2 changed files with 12 additions and 6 deletions

View File

@ -32,4 +32,4 @@ jobs:
- name: Build
env:
SIM: ${{matrix.simulators}}
run: make LTO=1 $SIM
run: make LTO=1 OPTIMIZE=-O3 $SIM

View File

@ -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
@ -329,7 +335,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
@ -337,7 +343,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))
@ -1307,7 +1313,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