diff options
author | brooks <brooks@FreeBSD.org> | 2012-09-13 16:00:46 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2012-09-13 16:00:46 +0000 |
commit | f17cb55447d48bc158b5154afa555cbb98793552 (patch) | |
tree | 026ab7b76d6035ab651e3761d73e9f9f465ed976 /Makefile.inc1 | |
parent | 1e4174de1a4f6a3cd6d80a545ec7187ecc402d68 (diff) | |
download | FreeBSD-src-f17cb55447d48bc158b5154afa555cbb98793552.zip FreeBSD-src-f17cb55447d48bc158b5154afa555cbb98793552.tar.gz |
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 <yamayan@kbh.biglobe.ne.jp>, imp, linimon
(with some modifications post review)
MFC after: 2 weeks
Diffstat (limited to 'Makefile.inc1')
-rw-r--r-- | Makefile.inc1 | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Makefile.inc1 b/Makefile.inc1 index 1ea269b..821416d 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -46,6 +46,7 @@ TARGET_ARCH=${TARGET} .include <bsd.own.mk> .include <bsd.arch.inc.mk> +.include <bsd.compiler.mk> # We must do share/info early so that installation of info `dir' # entries works correctly. Do it first since it is less likely to @@ -235,7 +236,8 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${BPATH}:${PATH} \ WORLDTMP=${WORLDTMP} \ VERSION="${VERSION}" \ - MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" + MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ + COMPILER_TYPE=${COMPILER_TYPE} BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ DESTDIR= \ @@ -270,6 +272,16 @@ WMAKEENV= ${CROSSENV} \ .if ${MK_CDDL} == "no" WMAKEENV+= NO_CTF=1 .endif +.if ${CC:T:Mgcc} == "gcc" +WMAKE_COMPILER_TYPE= gcc +.elif ${CC:T:Mclang} == "clang" +WMAKE_COMPILER_TYPE= clang +.elif ${MK_CLANG_IS_CC} == "no" +WMAKE_COMPILER_TYPE= gcc +.else +WMAKE_COMPILER_TYPE= clang +.endif +WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" @@ -313,7 +325,8 @@ LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ CC="${CC} ${LIB32FLAGS}" \ CXX="${CXX} ${LIB32FLAGS}" \ LIBDIR=/usr/lib32 \ - SHLIBDIR=/usr/lib32 + SHLIBDIR=/usr/lib32 \ + COMPILER_TYPE=${WMAKE_COMPILER_TYPE} LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DNO_CPU_CFLAGS -DCOMPAT_32BIT \ -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ |