From: Peter Lemenkov Date: Sun, 2 Dec 2018 11:17:55 +0300 Subject: [PATCH] Dont' try modifying CFLAGS Signed-off-by: Peter Lemenkov diff --git a/Makefile.defs b/Makefile.defs index 2a133125c..359d1593d 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -793,525 +793,8 @@ endif CFLAGS=$(shell echo "$${CFLAGS}") LDFLAGS+= -ifneq (,$(findstring DBG_MALLOC, $(DEFS))) - CC_OPTIMIZE_FLAG?=-O0 -endif - -ifeq ($(CC_NAME), gcc) - CC_OPTIMIZE_FLAG?=-O9 -endif -ifeq ($(CC_NAME), icc) - CC_OPTIMIZE_FLAG?=-O3 -endif -ifeq ($(CC_NAME), clang) - CC_OPTIMIZE_FLAG?=-O3 -endif - ifeq (,$(CFLAGS)) -#common stuff -CFLAGS+=$(DEBUGSYM) - -# setting more CFLAGS -ifeq ($(mode), release) - -#if i386 -ifeq ($(ARCH), i386) - # These CPU optimization assumes that you run a Intel processor. - # If you use a AMD CPU, you could ajust the settings here for better - # performance. For gcc 4.x use CPU_TYPE ?= athlon-xp - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=-m32 $(CC_OPTIMIZE_FLAG) -funroll-loops -Wcast-align $(PROFILE) \ - -Wall - LDFLAGS+=-m32 - #if gcc 4.0+ -ifeq ($(CC_CLASS), 4.x) - ARCH_VER=$(shell $(GETARCH)) -ifeq ($(ARCH_VER), i386) - CPU_TYPE ?= i686 -else - CPU_TYPE ?= prescott -endif - CFLAGS+=-minline-all-stringops \ - -falign-loops \ - -ftree-vectorize \ - -mtune=$(CPU_TYPE) \ - -Wold-style-definition -Wmissing-field-initializers -Wredundant-decls - -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CPU_TYPE ?= pentium4 - CFLAGS+=-minline-all-stringops \ - -falign-loops -ifeq (X,$(shell echo "$(CC_SHORTVER)" | sed -e 's/3\.[0-3]/X/')) - CFLAGS+=-mcpu=$(CPU_TYPE) -else - CFLAGS+=-mtune=$(CPU_TYPE) -endif -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \ - for better results) - - CFLAGS+=-m486 \ - -malign-loops=4 -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc -ifeq ($(CC_NAME), icc) - CFLAGS+=$(CC_OPTIMIZE_FLAG) -ipo -ipo_obj -unroll $(PROFILE) \ - -tpp6 -xK #-openmp #optimize for PIII - # -prefetch doesn't seem to work - #( ty to inline acroos files, unroll loops,prefetch, - # optimize for PIII, use PIII instructions & vect., - # mutlithread loops) -else #CC_NAME, icc -ifeq ($(CC_NAME), suncc) - CFLAGS+=-xO5 -fast -native -xCC \ - -xc99=no_lib # C99 support - # -Dinline="" # add this if cc < 5.3 (define inline as null) -else -ifeq ($(CC_NAME), clang) - CFLAGS+=$(CC_OPTIMIZE_FLAG) -Wall -funroll-loops -else - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, clang -endif #CC_NAME, suncc -endif #CC_NAME, icc -endif #CC_NAME, gcc -endif #ARCH, i386 - -#x86_64 -ifeq ($(ARCH), x86_64) - # These CPU optimization assumes that you run a Intel 64 processor. - # If you use a AMD 64 CPU, you could ajust the settings here for better - # performance. For gcc 4.x use CPU_TYPE ?= athlon64 - # Perhaps it makes sense to use '-m64' here? - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops -Wcast-align $(PROFILE) \ - -Wall - #if gcc 4.0+ -ifeq ($(CC_CLASS), 4.x) - CPU_TYPE ?= nocona - CFLAGS+=-minline-all-stringops \ - -falign-loops \ - -ftree-vectorize \ - -mtune=$(CPU_TYPE) \ - -Wold-style-definition -Wmissing-field-initializers -Wredundant-decls -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CPU_TYPE ?= nocona - CFLAGS+=-minline-all-stringops \ - -falign-loops \ - -mtune=$(CPU_TYPE) -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \ - for better results) - - CFLAGS+=-m486 \ - -malign-loops=4 -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc -ifeq ($(CC_NAME), icc) - CFLAGS+=$(CC_OPTIMIZE_FLAG) -ipo -ipo_obj -unroll $(PROFILE) \ - -tpp6 -xK #-openmp #optimize for PIII - # -prefetch doesn't seem to work - #( ty to inline acroos files, unroll loops,prefetch, - # optimize for PIII, use PIII instructions & vect., - # mutlithread loops) -else -ifeq ($(CC_NAME), suncc) - CFLAGS+=-xO5 -fast -native -xCC \ - -xc99=no_lib # C99 support - # -Dinline="" # add this if cc < 5.3 (define inline as null) -else -ifeq ($(CC_NAME), clang) - CFLAGS+=$(CC_OPTIMIZE_FLAG) -Wall -funroll-loops -else - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, clang -endif #CC_NAME, icc -endif #CC_NAME, gcc -endif #CC_NAME, suncc -endif #ARCH, x86_64 - - #if sparc -ifeq ($(ARCH), sparc64) - #if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops $(PROFILE) \ - -Wall\ - #-Wcast-align \ - #-Wmissing-prototypes - #if gcc 4.x -ifeq ($(CC_CLASS), 4.x) - - # Processors of Family UltraSparc II - ifeq ($(CHIP), ultrasparc-ii) - CFLAGS+= -ftree-vectorize -mcpu=ultrasparc -mtune=ultrasparc -mvis - endif - - # Processors of Family UltraSparc III (III, III, IIIi, IIICu) - ifeq ($(CHIP), ultrasparc-iiii) - CFLAGS+= -ftree-vectorize -mcpu=ultrasparc3 -mtune=ultrasparc3 -mvis - endif - - ifeq ($(CHIP), ultrasparc-iii) - CFLAGS+= -ftree-vectorize -mcpu=ultrasparc3 -mtune=ultrasparc3 -mvis - endif - - ifeq ($(CHIP), ultrasparc-iiicu) - CFLAGS+= -ftree-vectorize -mcpu=ultrasparc3 -mtune=ultrasparc3 -mvis - endif - - # Processors of Family UltraSparc T1 - ifeq ($(CHIP), ultrasparc-t1) - # niagara switch is not supported on GCC < 4.2 - # Sets to default ultrasparc - ifeq ($(CC_SHORTVER), 4.2) - CFLAGS+= -ftree-vectorize -mcpu=niagara -mtune=niagara -mvis - else - ifeq ($(CC_SHORTVER), 4.3) - CFLAGS+= -ftree-vectorize -mcpu=niagara -mtune=niagara -mvis - else - CFLAGS+= -ftree-vectorize -mcpu=ultrasparc -mtune=ultrasparc -mvis - endif - endif - endif - - # If processor detection fails, defaults to UltraSPARC without VIS - ifeq (,$(CHIP)) - #CPU_TYPE=ultrasparc - CFLAGS += -mcpu=ultrasparc -mtune=ultrasparc - endif - - # use -m64 to force 64 bit (but add it also to LDFLAGS), - # -m32 for 32 bit (default on solaris), - # nothing for arch. default - # -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu - #-mno-epilogue #try to inline function exit code - #-mflat # omit save/restore - #-,faster-structs #faster non Sparc ABI structure copy ops - -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - - # Processors of Family UltraSparc II - ifeq ($(CHIP), ultrasparc-ii) - #CPU_TYPE=ultrasparc - CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc -mvis - endif - - # Processors of Family UltraSparc III - ifeq ($(CHIP), ultrasparc-iiii) - CFLAGS+= -mcpu=ultrasparc3 -mtune=ultrasparc3 -mvis - endif - - ifeq ($(CHIP), ultrasparc-iiii) - CFLAGS+= -mcpu=ultrasparc3 -mtune=ultrasparc3 -mvis - endif - - ifeq ($(CHIP), ultrasparc-iiicu) - CFLAGS+= -mcpu=ultrasparc3 -mtune=ultrasparc3 -mvis - endif - - # Processors of Family UltraSparc T1 - ifeq ($(CHIP), ultrasparc-t1) - # niagara switch is not supported on GCC < 4.2 - # Sets to default ultrasparc - CFLAGS+= -mcpu=ultrasparc -mtune=ultrasparc -mvis - endif - - # If processor detection fails, defaults to UltraSPARC without VIS - ifeq (,$(CHIP)) - #CPU_TYPE=ultrasparc - CFLAGS += -mcpu=ultrasparc -mtune=ultrasparc - endif - - # use -m64 to force 64 bit (but add it also to LDFLAGS), - # -m32 for 32 bit (default on solaris), - # nothing for arch. default - # -mcpu=v9 or ultrasparc? # -mtune implied by -mcpu - #-mno-epilogue #try to inline function exit code - #-mflat # omit save/restore - #-,faster-structs #faster non Sparc ABI structure copy ops - -else # CC_CLASS, 3.0 -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc >= 3.1 \ - for better results) -ifneq ($(OS), netbsd) - # on netbsd/sparc64, gcc 2.95.3 does not compile - # opensips with -mv8 - CFLAGS+= -mv8 -endif -ifeq ($(ASTYPE), solaris) - CFLAGS+= -Wa,-xarch=v8plus -endif -else #CC_CLASS, 2.9x - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - - CFLAGS+= -mv8 -ifeq ($(ASTYPE), solaris) - CFLAGS+= -Wa,-xarch=v8plus -endif - -endif #CC_CLASS, 2.9x -endif #CC_CLASS, 3.x -endif #CC_CLASS, 4.x - -else #CC_NAME, gcc -ifeq ($(CC_NAME), suncc) - CFLAGS+=-xO5 -fast -native -xarch=v8plusa -xCC \ - -xc99=no_lib # C99 support - # -Dinline="" # add this if cc < 5.3 (define inline as null) -else - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, suncc -endif #CC_NAME, gcc -endif #ARCH, sparc64 - - #if ipaq/netwinder -ifeq ($(ARCH), arm) - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops -Wcast-align $(PROFILE) \ - -Wall -marm - #if gcc 4.x+ -ifeq ($(CC_CLASS), 4.x) - CFLAGS+=-mcpu=strongarm1100 -ftree-vectorize -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CFLAGS+= -mcpu=strongarm1100 -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \ - for better results) - - CFLAGS+= -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, gcc -endif #ARCH, arm - - #if mips (R3000) -ifeq ($(ARCH), mips) - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops -Wcast-align $(PROFILE) \ - -Wall - #if gcc 4.0+ -ifeq ($(CC_CLASS), 4.x) - CFLAGS+=-mcpu=r3000 -minline-all-stringops \ - -ftree-vectorize -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CFLAGS+= -mcpu=r3000 - #-mcpu=athlon -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \ - for better results) - - CFLAGS+=-mcpu=r3000 -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, gcc -endif #ARCH, mips - - #if >=mips2 (R4000, R5000, R6000 ....) -ifeq ($(ARCH), mips2) - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -mips2 -funroll-loops $(PROFILE) \ - -Wall - #if gcc 4.0+ -ifeq ($(CC_CLASS), 4.x) - CFLAGS+=-minline-all-stringops -ftree-vectorize -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CFLAGS+= -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \ - for better results) - CFLAGS+= -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, gcc -endif #ARCH, mips2 - -#if alpha -ifeq ($(ARCH), alpha) - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops $(PROFILE) -Wall - #if gcc 4.0+ -ifeq ($(CC_CLASS), 4.x) - CFLAGS+=-minline-all-stringops -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CFLAGS+= -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \ - for better results) - CFLAGS+= -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, gcc -endif #ARCH, alpha - -#if ppc -ifeq ($(ARCH), ppc) - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops $(PROFILE) -Wall - #if gcc 4.0+ -ifeq ($(CC_CLASS), 4.x) - CPU_TYPE ?= powerpc - CFLAGS+=-ftree-vectorize \ - -mtune=$(CPU_TYPE) -maltivec -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CFLAGS+= -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \ - for better results) - CFLAGS+= -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, gcc -endif #ARCH, ppc - -#if ppc64 -ifeq ($(ARCH), ppc64) - # if gcc -ifeq ($(CC_NAME), gcc) - #common stuff - CFLAGS+=$(CC_OPTIMIZE_FLAG) -funroll-loops $(PROFILE) -Wall -ifeq ($(CC_CLASS), 4.x) - CPU_TYPE ?= powerpc64 - CFLAGS+=-ftree-vectorize \ - -mtune=$(CPU_TYPE) -maltivec -else - #if gcc 3.0+ -ifeq ($(CC_CLASS), 3.x) - CFLAGS+= -else -ifeq ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5]) -$(warning Old gcc detected ($(CC_SHORTVER)), use gcc 3.0.x \ - for better results) - CFLAGS+= -else - #really old version -$(warning You are using an old and unsupported gcc \ - version ($(CC_SHORTVER)), compile at your own risk!) - -endif # CC_CLASS, 2.9x -endif # CC_CLASS, 3.x -endif # CC_CLASS, 4.x - -else # CC_NAME, gcc - #other compilers -$(error Unsupported compiler ($(CC):$(CC_NAME)), try gcc) -endif #CC_NAME, gcc -endif #ARCH, ppc - -endif # CFLAGS not set - -CFLAGS+= $(CC_EXTRA_OPTS) - LD_EXTRA_OPTS ?= # setting LDFLAGS