Module: sip-router
Branch: 3.3
Commit: 7ad6202d80d5fee7248db732a789d37e48b24d1e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7ad6202…
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
(cherry picked from commit 0713c0de50f8c2f4da2ee0ef33b0505c37792392)
Conflicts:
Makefile.defs
---
Makefile.defs | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/Makefile.defs b/Makefile.defs
index 52eb8fc..962d8e9 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -266,7 +266,8 @@ CC_LONGVER:=$(shell if $(CC) -v 2>/dev/null; then \
else \
$(CC) -V 2>&1 ; \
fi )
-MKTAGS=ctags -R .
+CC_OPT ?= -O9
+MKTAGS=ctags
#find-out the compiler's name
@@ -327,6 +328,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
@@ -877,7 +879,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)
@@ -935,8 +937,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
@@ -962,7 +964,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+)
@@ -1031,7 +1033,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)
@@ -1056,7 +1058,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+
@@ -1147,7 +1149,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+
@@ -1212,7 +1214,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
@@ -1260,7 +1262,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))))
@@ -1307,7 +1309,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 \
@@ -1354,7 +1356,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 \
@@ -1399,7 +1401,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 \
@@ -1444,7 +1446,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
@@ -1490,7 +1492,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)
@@ -1539,7 +1541,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)