Module Name: src Committed By: joerg Date: Thu May 19 14:29:27 UTC 2011
Modified Files: src/share/mk: bsd.README bsd.own.mk Log Message: Add fine-grained compiler selection, including clang support. To generate a diff of this commit: cvs rdiff -u -r1.280 -r1.281 src/share/mk/bsd.README cvs rdiff -u -r1.666 -r1.667 src/share/mk/bsd.own.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/mk/bsd.README diff -u src/share/mk/bsd.README:1.280 src/share/mk/bsd.README:1.281 --- src/share/mk/bsd.README:1.280 Thu Mar 24 17:05:44 2011 +++ src/share/mk/bsd.README Thu May 19 14:29:27 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.README,v 1.280 2011/03/24 17:05:44 bouyer Exp $ +# $NetBSD: bsd.README,v 1.281 2011/05/19 14:29:27 joerg Exp $ # @(#)bsd.README 8.2 (Berkeley) 4/2/94 This is the README file for the make "include" files for the NetBSD @@ -446,6 +446,20 @@ set to "-g", "-g" will be added to COPTS only when compiling the crypto library. +The active compiler is selected using the following variables: +AVAILABLE_COMPILER + List of available compiler suites. Processed in order + for selecting the active compiler for each frontend. +HAVE_PCC If defined, PCC is present and enabled. +HAVE_LLVM If defined, LLVM/Clang is present and enabled. +UNSUPPORTED_COMPILER.xxx + If defined, the support for compiler "xxx" is disabled. + +For the frontends (CC, CPP, CXX, FC and OBJC) the following variables exist: +ACTIVE_CC Active compile suite for the CC frontend. +SUPPORTED_CC Compile suite with support for the CC frontend. +TOOL_CC.xxx Path to the CC frontend for compiler "xxx" + =-=-=-=-= sys.mk =-=-=-=-= The include file <sys.mk> has the default rules for all makes, in the BSD Index: src/share/mk/bsd.own.mk diff -u src/share/mk/bsd.own.mk:1.666 src/share/mk/bsd.own.mk:1.667 --- src/share/mk/bsd.own.mk:1.666 Thu May 19 06:09:36 2011 +++ src/share/mk/bsd.own.mk Thu May 19 14:29:27 2011 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.own.mk,v 1.666 2011/05/19 06:09:36 adam Exp $ +# $NetBSD: bsd.own.mk,v 1.667 2011/05/19 14:29:27 joerg Exp $ # This needs to be before bsd.init.mk .if defined(BSD_MK_COMPAT_FILE) @@ -172,11 +172,11 @@ SIZE= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-size STRIP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-strip -CC= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc -CPP= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp -CXX= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++ -FC= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77 -OBJC= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc +TOOL_CC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc +TOOL_CPP.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-cpp +TOOL_CXX.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-c++ +TOOL_FC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-g77 +TOOL_OBJC.gcc= ${EXTERNAL_TOOLCHAIN}/bin/${MACHINE_GNU_PLATFORM}-gcc .else # } { # Define default locations for common tools. .if ${USETOOLS_BINUTILS:Uyes} == "yes" # { @@ -189,23 +189,24 @@ RANLIB= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-ranlib SIZE= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-size STRIP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-strip -.endif # } -.if defined(HAVE_GCC) && ${USETOOLS_GCC:Uyes} == "yes" # { -CC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc -CPP= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp -CXX= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++ -FC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77 -OBJC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc +# GCC supports C, C++, Fortran and Objective C +TOOL_CC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc +TOOL_CPP.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-cpp +TOOL_CXX.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-c++ +TOOL_FC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-g77 +TOOL_OBJC.gcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-gcc .endif # } -.if defined(HAVE_PCC) && ${USETOOLS_PCC:Uyes} == "yes" -CC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc -CPP= ${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp -CXX= false -FC= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-f77 -OBJC= false -.endif +# Clang supports C, C++ and Objective C +TOOL_CC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang +TOOL_CPP.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang-cpp +TOOL_CXX.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang++ +TOOL_OBJC.clang= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-clang + +# PCC supports C and Fortran +TOOL_CC.pcc= ${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-pcc +TOOL_CPP.pcc= ${TOOLDIR}/libexec/${MACHINE_GNU_PLATFORM}-cpp # # Make sure DESTDIR is set, so that builds with these tools always @@ -318,6 +319,23 @@ .else # USETOOLS != yes # } { +# Clang supports C, C++ and Objective C +TOOL_CC.clang= clang +TOOL_CPP.clang= clang-cpp +TOOL_CXX.clang= clang++ +TOOL_OBJC.clang= clang + +# GCC supports C, C++, Fortran and Objective C +TOOL_CC.gcc= gcc +TOOL_CPP.gcc= cpp +TOOL_CXX.gcc= c++ +TOOL_FC.gcc= g77 +TOOL_OBJC.gcc= gcc + +# PCC supports C and Fortran +TOOL_CC.pcc= pcc +TOOL_CPP.pcc= /usr/libexec/pcpp + TOOL_AMIGAAOUT2BB= amiga-aout2bb TOOL_AMIGAELF2BB= amiga-elf2bb TOOL_AMIGATXLT= amiga-txlt @@ -397,6 +415,26 @@ .endif # USETOOLS != yes # } +# Fallback to ensure that all variables are defined to something +TOOL_CC.false= false +TOOL_CPP.false= false +TOOL_CXX.false= false +TOOL_FC.false= false +TOOL_OBJC.false= false + +AVAILABLE_COMPILER?= ${HAVE_PCC:Dpcc} ${HAVE_LLVM:Dclang} ${HAVE_GCC:Dgcc} false + +.for _t in CC CPP CXX FC OBJC +ACTIVE_${_t}= ${AVAILABLE_COMPILER:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@:[1]} +SUPPORTED_${_t}=${AVAILABLE_COMPILER:Nfalse:@.c.@ ${ !defined(UNSUPPORTED_COMPILER.${.c.}) && defined(TOOL_${_t}.${.c.}) :? ${.c.} : }@} +.endfor +# make bugs prevent moving this into the .for loop +CC= ${TOOL_CC.${ACTIVE_CC}} +CPP= ${TOOL_CPP.${ACTIVE_CPP}} +CXX= ${TOOL_CXX.${ACTIVE_CXX}} +FC= ${TOOL_FC.${ACTIVE_FC}} +OBJC= ${TOOL_OBJC.${ACTIVE_OBJC}} + # # Targets to check if DESTDIR or RELEASEDIR is provided #