From f17cb55447d48bc158b5154afa555cbb98793552 Mon Sep 17 00:00:00 2001 From: brooks Date: Thu, 13 Sep 2012 16:00:46 +0000 Subject: Introduce a new make variable COMPILER_TYPE that specifies what type of compiler is being used (currently clang or gcc). COMPILER_TYPE is set in the new bsd.compiler.mk file based on the value of the CC variable or, should it prove informative, by running ${CC} --version and examining the output. To avoid negative performance impacts in the default case and correct value for COMPILER_TYPE type is determined and passed in the environment of submake instances while building world. Replace adhoc attempts at determining the compiler type by examining CC or MK_CLANG_IS_CC with checks of COMPILER_TYPE. This eliminates bootstrapping complications when first setting WITH_CLANG_IS_CC. Sponsored by: DARPA, AFRL Reviewed by: Yamaya Takashi , imp, linimon (with some modifications post review) MFC after: 2 weeks --- sys/conf/kern.pre.mk | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/conf/kern.pre.mk') diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk index b491c75..fbf686a 100644 --- a/sys/conf/kern.pre.mk +++ b/sys/conf/kern.pre.mk @@ -4,6 +4,7 @@ # of the definitions that need to be before %BEFORE_DEPEND. .include +.include # backwards compat option for older systems. MACHINE_CPUARCH?=${MACHINE_ARCH:C/mips(n32|64)?(el)?/mips/:C/arm(v6)?(eb)?/arm/:C/powerpc64/powerpc/} @@ -35,7 +36,7 @@ _MINUS_O= -O2 .endif .endif .if ${MACHINE_CPUARCH} == "amd64" -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${COMPILER_TYPE} != "clang" COPTFLAGS?=-O2 -frename-registers -pipe .else COPTFLAGS?=-O2 -pipe @@ -85,7 +86,7 @@ INCLUDES+= -I$S/dev/cxgb -I$S/dev/cxgbe CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS} CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -.if ${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang" +.if ${COMPILER_TYPE} != "clang" CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT} .if ${MACHINE_CPUARCH} != "mips" CFLAGS+= --param inline-unit-growth=100 @@ -102,7 +103,7 @@ WERROR?= -Werror # XXX LOCORE means "don't declare C stuff" not "for locore.s". ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} -.if ${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang" +.if ${COMPILER_TYPE} == "clang" CLANG_NO_IAS= -no-integrated-as .endif -- cgit v1.1