bsd.compiler.mk: detect Apple Clang for cross-builds
Apple clang uses a different versioning scheme, so if we enable or disable certain warnings for Clang 11+, those might not be supported in Apple Clang 11+. This adds 'apple-clang' to COMPILER_FEATURES, so that bootstrap tools Makefiles can avoid warnings on macOS. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D29680
This commit is contained in:
parent
faa9ad8a90
commit
ba1182e263
@ -26,6 +26,12 @@
|
||||
# mitigation.
|
||||
# - init-all: supports stack variable initialization.
|
||||
#
|
||||
# When bootstrapping on macOS, 'apple-clang' will be set in COMPILER_FEATURES
|
||||
# to differentiate Apple's version of Clang. Apple Clang uses a different
|
||||
# versioning scheme and may not support the same -W/-Wno warning flags. For a
|
||||
# mapping of Apple Clang versions to upstream clang versions see
|
||||
# https://en.wikipedia.org/wiki/Xcode#Xcode_7.0_-_12.x_(since_Free_On-Device_Development)
|
||||
#
|
||||
# These variables with an X_ prefix will also be provided if XCC is set.
|
||||
#
|
||||
# This file may be included multiple times, but only has effect the first time.
|
||||
@ -202,6 +208,10 @@ ${X_}COMPILER_TYPE:= gcc
|
||||
.if !defined(${X_}COMPILER_VERSION)
|
||||
${X_}COMPILER_VERSION!=echo "${_v:M[1-9]*.[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}'
|
||||
.endif
|
||||
# Detect apple clang when bootstrapping to select appropriate warning flags.
|
||||
.if !defined(${X_}COMPILER_FEATURES) && ${_v:[*]:M*Apple clang version*}
|
||||
${X_}COMPILER_FEATURES= apple-clang
|
||||
.endif
|
||||
.undef _v
|
||||
.endif
|
||||
.if !defined(${X_}COMPILER_FREEBSD_VERSION)
|
||||
@ -218,7 +228,7 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown
|
||||
${X_}COMPILER_RESOURCE_DIR!= ${${cc}:N${CCACHE_BIN}} -print-resource-dir 2>/dev/null || echo unknown
|
||||
.endif
|
||||
|
||||
${X_}COMPILER_FEATURES= c++11 c++14
|
||||
${X_}COMPILER_FEATURES+= c++11 c++14
|
||||
.if ${${X_}COMPILER_TYPE} == "clang" || \
|
||||
(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 70000)
|
||||
${X_}COMPILER_FEATURES+= c++17
|
||||
|
Loading…
Reference in New Issue
Block a user