Module: sip-router
Branch: master
Commit: 0713c0de50f8c2f4da2ee0ef33b0505c37792392
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0713c0d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Dec 6 16:33:04 2013 +0100
Makefile.defs: compiler optimization level made variable
- allow using -O3 for clang, which gives error on the former default -O9
---
Makefile.defs | 32 +++++++++++++++++---------------
1 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs
index d0ce0c8..0db57fe 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -273,6 +273,7 @@ CC_LONGVER:=$(shell if $(CC) -v 2>/dev/null; then \
else \
$(CC) -V 2>&1 ; \
fi )
+CC_OPT ?= -O9
MKTAGS=ctags
#find-out the compiler's name
@@ -334,6 +335,7 @@ ifneq (, $(findstring clang, $(CC_LONGVER)))
CC_FULLVER:=$(shell echo "$(CC_LONGVER)" | head -n 1 | sed -e
's/.*version \([0-9]\.[0-9]\).*/\1/g' )
CC_SHORTVER:=$(shell echo "$(CC_FULLVER)" | cut -d. -f1,2 )
CC_VER=$(CC) $(CC_FULLVER)
+ CC_OPT=-O3
MKDEP=$(CC) -MM
endif
@@ -887,7 +889,7 @@ ifeq ($(ARCH), i386)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE)
+ CFLAGS=-g $(CC_OPT) -funroll-loops -Wcast-align $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
$(call set_if_empty,CPU,athlon64)
@@ -945,8 +947,8 @@ ifeq ($(CC_NAME), clang)
$(call set_if_empty,CPU,athlon64)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-m32
- -O9 \
- \
+ $(CC_OPT) \
+ \
-mtune=$(CPU)
LDFLAGS+=-m32
else # CC_NAME, clang
@@ -972,7 +974,7 @@ ifeq ($(ARCH), x86_64)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS=-g -O9 -funroll-loops -Wcast-align $(PROFILE)
+ CFLAGS=-g $(CC_OPT) -funroll-loops -Wcast-align $(PROFILE)
#if gcc 4.5+
# don't add '-mtune=$(CPU)' - gcc failure
ifeq ($(CC_SHORTVER), 4.5+)
@@ -1041,7 +1043,7 @@ ifeq ($(CC_NAME), clang)
$(call set_if_empty,CPU,opteron)
C_DEFS+=-DCC_GCC_LIKE_ASM
CFLAGS+=-m64 \
- -O9
+ $(CC_OPT)
LDFLAGS+=-m64
else # CC_NAME, clang
ifeq ($(CC_NAME), icc)
@@ -1066,7 +1068,7 @@ ifeq ($(ARCH), sparc64)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM -DSPARC64_MODE
#common stuff
- CFLAGS=-g -O9 -funroll-loops $(PROFILE) \
+ CFLAGS=-g $(CC_OPT) -funroll-loops $(PROFILE) \
#-Wcast-align \
#-Wmissing-prototypes
#if gcc 4.5+ or 4.2+
@@ -1157,7 +1159,7 @@ ifeq ($(ARCH), sparc)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS=-g -O9 -funroll-loops $(PROFILE) \
+ CFLAGS=-g $(CC_OPT) -funroll-loops $(PROFILE) \
#-Wcast-align \
#-Wmissing-prototypes
#if gcc 4.5+ or 4.2+
@@ -1222,7 +1224,7 @@ ifeq ($(ARCH), arm)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS=-marm -march=armv5t -O9 -funroll-loops -fsigned-char $(PROFILE)
+ CFLAGS=-marm -march=armv5t $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
CFLAGS+= -ftree-vectorize -fno-strict-overflow
@@ -1270,7 +1272,7 @@ ifeq ($(ARCH), arm6)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS=-march=armv6 -O9 -funroll-loops -fsigned-char \
+ CFLAGS=-march=armv6 $(CC_OPT) -funroll-loops -fsigned-char \
$(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
@@ -1317,7 +1319,7 @@ ifeq ($(ARCH), mips)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS=-O9 -funroll-loops $(PROFILE)
+ CFLAGS=$(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
CFLAGS+=-march=r3000 -minline-all-stringops \
@@ -1364,7 +1366,7 @@ ifeq ($(ARCH), mips2)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS= -mips2 -O9 -funroll-loops $(PROFILE)
+ CFLAGS= -mips2 $(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
CFLAGS+=-minline-all-stringops -ftree-vectorize \
@@ -1409,7 +1411,7 @@ ifeq ($(ARCH), mips64)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS= -mips64 -O9 -funroll-loops $(PROFILE)
+ CFLAGS= -mips64 $(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
CFLAGS+=-minline-all-stringops -ftree-vectorize \
@@ -1454,7 +1456,7 @@ ifeq ($(ARCH), alpha)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS= -O9 -funroll-loops $(PROFILE)
+ CFLAGS= $(CC_OPT) -funroll-loops $(PROFILE)
#if gcc 4.5 or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
CFLAGS+= -fno-strict-overflow
@@ -1500,7 +1502,7 @@ ifeq ($(ARCH), ppc)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS= -O9 -funroll-loops -fsigned-char $(PROFILE)
+ CFLAGS= $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
$(call set_if_empty,CPU,powerpc)
@@ -1549,7 +1551,7 @@ ifeq ($(ARCH), ppc64)
ifeq ($(CC_NAME), gcc)
C_DEFS+=-DCC_GCC_LIKE_ASM
#common stuff
- CFLAGS= -O9 -funroll-loops -fsigned-char $(PROFILE)
+ CFLAGS= $(CC_OPT) -funroll-loops -fsigned-char $(PROFILE)
#if gcc 4.5+ or 4.2+
ifeq (,$(strip $(filter-out 4.2+ 4.5+,$(CC_SHORTVER))))
$(call set_if_empty,CPU,powerpc64)