diff options
author | Brooks Davis <brooks@FreeBSD.org> | 2012-09-13 16:00:46 +0000 |
---|---|---|
committer | Brooks Davis <brooks@FreeBSD.org> | 2012-09-13 16:00:46 +0000 |
commit | 9215d178a47786b3dc9f6527bc8dc8995492c756 (patch) | |
tree | 026ab7b76d6035ab651e3761d73e9f9f465ed976 /share/mk/bsd.compiler.mk | |
parent | 0f14f15b62ced09a2eb935dd174f8baf1cbb9657 (diff) | |
download | src-9215d178a47786b3dc9f6527bc8dc8995492c756.tar.gz src-9215d178a47786b3dc9f6527bc8dc8995492c756.zip |
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
Notes
Notes:
svn path=/head/; revision=240468
Diffstat (limited to 'share/mk/bsd.compiler.mk')
-rw-r--r-- | share/mk/bsd.compiler.mk | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk new file mode 100644 index 000000000000..cca3968046e7 --- /dev/null +++ b/share/mk/bsd.compiler.mk @@ -0,0 +1,21 @@ +# $FreeBSD$ + +.if !defined(COMPILER_TYPE) +. if ${CC:T:Mgcc} == "gcc" +COMPILER_TYPE:= gcc +. elif ${CC:T:Mclang} == "clang" +COMPILER_TYPE:= clang +. else +_COMPILER_VERSION!= ${CC} --version +. if ${_COMPILER_VERSION:Mgcc} == "gcc" +COMPILER_TYPE:= gcc +. elif ${_COMPILER_VERSION:M\(GCC\)} == "(GCC)" +COMPILER_TYPE:= gcc +. elif ${_COMPILER_VERSION:Mclang} == "clang" +COMPILER_TYPE:= clang +. else +.error Unable to determing compiler type for ${CC} +. endif +. undef _COMPILER_VERSION +. endif +.endif |