bsd.compiler.mk (284345) | bsd.compiler.mk (289659) |
---|---|
1# $FreeBSD: head/share/mk/bsd.compiler.mk 284345 2015-06-13 19:20:56Z sjg $ | 1# $FreeBSD: head/share/mk/bsd.compiler.mk 289659 2015-10-20 20:15:25Z bdrewery $ |
2 3# Setup variables for the compiler 4# 5# COMPILER_TYPE is the major type of compiler. Currently gcc and clang support 6# automatic detection. Other compiler types can be shoe-horned in, but require 7# explicit setting of the compiler type. The compiler type can also be set 8# explicitly if, say, you install gcc as clang... 9# --- 10 unchanged lines hidden (view full) --- 20# - c++11 : supports full (or nearly full) C++11 programming environment. 21# 22# This file may be included multiple times, but only has effect the first time. 23# 24 25.if !target(__<bsd.compiler.mk>__) 26__<bsd.compiler.mk>__: 27 | 2 3# Setup variables for the compiler 4# 5# COMPILER_TYPE is the major type of compiler. Currently gcc and clang support 6# automatic detection. Other compiler types can be shoe-horned in, but require 7# explicit setting of the compiler type. The compiler type can also be set 8# explicitly if, say, you install gcc as clang... 9# --- 10 unchanged lines hidden (view full) --- 20# - c++11 : supports full (or nearly full) C++11 programming environment. 21# 22# This file may be included multiple times, but only has effect the first time. 23# 24 25.if !target(__<bsd.compiler.mk>__) 26__<bsd.compiler.mk>__: 27 |
28# Try to import COMPILER_TYPE and COMPILER_VERSION from parent make. 29# The value is only used/exported for the same environment that impacts 30# CC and COMPILER_* settings here. 31_exported_vars= COMPILER_TYPE COMPILER_VERSION 32_cc_hash= ${CC}${MACHINE}${PATH} 33_cc_hash:= ${_cc_hash:hash} 34.for var in ${_exported_vars} 35.if defined(${var}.${_cc_hash}) 36${var}= ${${var}.${_cc_hash}} 37.endif 38.endfor 39 |
|
28.if ${MACHINE} == "common" 29# common is a pseudo machine for architecture independent 30# generated files - thus there is no compiler. 31COMPILER_TYPE= none 32COMPILER_VERSION= 0 33.elif !defined(COMPILER_TYPE) || !defined(COMPILER_VERSION) 34_v!= ${CC} --version 2>/dev/null || echo 0.0.0 35 --- 13 unchanged lines hidden (view full) --- 49. endif 50.endif 51.if !defined(COMPILER_VERSION) 52COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' 53.endif 54.undef _v 55.endif 56 | 40.if ${MACHINE} == "common" 41# common is a pseudo machine for architecture independent 42# generated files - thus there is no compiler. 43COMPILER_TYPE= none 44COMPILER_VERSION= 0 45.elif !defined(COMPILER_TYPE) || !defined(COMPILER_VERSION) 46_v!= ${CC} --version 2>/dev/null || echo 0.0.0 47 --- 13 unchanged lines hidden (view full) --- 61. endif 62.endif 63.if !defined(COMPILER_VERSION) 64COMPILER_VERSION!=echo ${_v:M[1-9].[0-9]*} | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' 65.endif 66.undef _v 67.endif 68 |
69# Export the values so sub-makes don't have to look them up again, using the 70# hash key computed above. 71.for var in ${_exported_vars} 72${var}.${_cc_hash}:= ${${var}} 73.export-env ${var}.${_cc_hash} 74.undef ${var}.${_cc_hash} 75.endfor 76 |
|
57.if ${COMPILER_TYPE} == "clang" || \ 58 (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800) 59COMPILER_FEATURES= c++11 60.else 61COMPILER_FEATURES= 62.endif 63 64.endif # !target(__<bsd.compiler.mk>__) | 77.if ${COMPILER_TYPE} == "clang" || \ 78 (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800) 79COMPILER_FEATURES= c++11 80.else 81COMPILER_FEATURES= 82.endif 83 84.endif # !target(__<bsd.compiler.mk>__) |