makefile: Add OPTIMIZE= command option to change default from -O3
This commit is contained in:
parent
1792303a9e
commit
9cfa212e60
1 changed files with 9 additions and 5 deletions
14
makefile
14
makefile
|
@ -49,7 +49,10 @@
|
||||||
# cause the build to use Link Time Optimization to maximally optimize
|
# cause the build to use Link Time Optimization to maximally optimize
|
||||||
# the results. Link Time Optimization can report errors which aren't
|
# the results. Link Time Optimization can report errors which aren't
|
||||||
# otherwise detected and will also take significantly longer to
|
# otherwise detected and will also take significantly longer to
|
||||||
# complete.
|
# 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)
|
||||||
|
# on the command line if desired.
|
||||||
#
|
#
|
||||||
# The default build will run per simulator tests if they are
|
# The default build will run per simulator tests if they are
|
||||||
# available. If building without running tests is desired,
|
# available. If building without running tests is desired,
|
||||||
|
@ -492,7 +495,7 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
|
||||||
endif
|
endif
|
||||||
OS_CCDEFS += -D_HPUX_SOURCE -D_LARGEFILE64_SOURCE
|
OS_CCDEFS += -D_HPUX_SOURCE -D_LARGEFILE64_SOURCE
|
||||||
OS_LDFLAGS += -Wl,+b:
|
OS_LDFLAGS += -Wl,+b:
|
||||||
LTO =
|
override LTO =
|
||||||
else
|
else
|
||||||
LIBEXT = a
|
LIBEXT = a
|
||||||
endif
|
endif
|
||||||
|
@ -1263,6 +1266,7 @@ endif
|
||||||
ifneq (,$(UNSUPPORTED_BUILD))
|
ifneq (,$(UNSUPPORTED_BUILD))
|
||||||
CFLAGS_GIT += -DSIM_BUILD=Unsupported=$(UNSUPPORTED_BUILD)
|
CFLAGS_GIT += -DSIM_BUILD=Unsupported=$(UNSUPPORTED_BUILD)
|
||||||
endif
|
endif
|
||||||
|
OPTIMIZE ?= -O3
|
||||||
ifneq ($(DEBUG),)
|
ifneq ($(DEBUG),)
|
||||||
CFLAGS_G = -g -ggdb -g3
|
CFLAGS_G = -g -ggdb -g3
|
||||||
CFLAGS_O = -O0
|
CFLAGS_O = -O0
|
||||||
|
@ -1270,10 +1274,10 @@ ifneq ($(DEBUG),)
|
||||||
LTO =
|
LTO =
|
||||||
else
|
else
|
||||||
ifneq (,$(findstring clang,$(COMPILER_NAME))$(findstring LLVM,$(COMPILER_NAME)))
|
ifneq (,$(findstring clang,$(COMPILER_NAME))$(findstring LLVM,$(COMPILER_NAME)))
|
||||||
CFLAGS_O = -O3 -fno-strict-overflow
|
CFLAGS_O = $(OPTIMIZE) -fno-strict-overflow
|
||||||
GCC_OPTIMIZERS_CMD = ${GCC} --help 2>&1
|
GCC_OPTIMIZERS_CMD = ${GCC} --help 2>&1
|
||||||
else
|
else
|
||||||
CFLAGS_O := -O3
|
CFLAGS_O := $(OPTIMIZE)
|
||||||
endif
|
endif
|
||||||
LDFLAGS_O =
|
LDFLAGS_O =
|
||||||
GCC_MAJOR_VERSION = $(firstword $(subst ., ,$(GCC_VERSION)))
|
GCC_MAJOR_VERSION = $(firstword $(subst ., ,$(GCC_VERSION)))
|
||||||
|
@ -1308,7 +1312,7 @@ else
|
||||||
CFLAGS_O += -fno-strict-overflow
|
CFLAGS_O += -fno-strict-overflow
|
||||||
endif
|
endif
|
||||||
ifneq (,$(findstring $(GCC_VERSION),$(LTO_EXCLUDE_VERSIONS)))
|
ifneq (,$(findstring $(GCC_VERSION),$(LTO_EXCLUDE_VERSIONS)))
|
||||||
LTO =
|
override LTO =
|
||||||
endif
|
endif
|
||||||
ifneq (,$(LTO))
|
ifneq (,$(LTO))
|
||||||
ifneq (,$(findstring -flto,$(GCC_OPTIMIZERS)))
|
ifneq (,$(findstring -flto,$(GCC_OPTIMIZERS)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue