diff --git a/CHANGES b/CHANGES --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,13 @@ All ports committers are allowed to commit to this file. +20230823: +AUTHOR: tcberner@FreeBSD.org + + USES=llvm.mk now supports 'export' (default) and 'noexport' arguments. + When export is set, CC, CXX and CPP will be set to the path corresponding + to the chosen llvm-version. + 20230821: AUTHOR: jhale@FreeBSD.org diff --git a/Mk/Uses/llvm.mk b/Mk/Uses/llvm.mk --- a/Mk/Uses/llvm.mk +++ b/Mk/Uses/llvm.mk @@ -14,6 +14,10 @@ # min=number: use specified min if ${LLVM_DEFAULT} is lower # max=number: use specified max if ${LLVM_DEFAULT} is higher # +# * environment +# export: do export CC, CXX,... variables [default] +# noexport: do not export CC,CXX,... variables +# # An example usage might be: # USES= llvm # or @@ -35,6 +39,7 @@ _LLVM_MK_VALID_VERSIONS= 10 11 12 13 14 15 16 _LLVM_MK_VALID_CONSTRAINTS= min max _LLVM_MK_VALID_MODES= build run lib +_LLVM_MK_VALID_EXPORTS= export noexport # === parse mode arguments === _LLVM_MK_MODES= # empty @@ -66,6 +71,21 @@ . endif . endif +# === parse environment arguments === +_LLVM_MK_EXPORT= # empty +. for _export in ${_LLVM_MK_VALID_EXPORTS} +. if ${llvm_ARGS:M${_export}} +. if !empty(_LLVM_MK_EXPORT) +BROKEN= USES=llvm:${llvm_ARGS} contains multiple export definitions +. else +_LLVM_MK_EXPORT= ${_export} +. endif +. endif +. endfor +. if empty(_LLVM_MK_EXPORT) +_LLVM_MK_EXPORT= export +. endif + # === handle constraints === . for _constraint in ${_LLVM_MK_VALID_CONSTRAINTS} _version= ${llvm_ARGS:M${_constraint}=[0-9]*:S/${_constraint}=//} @@ -115,4 +135,10 @@ LLVM_VERSION= ${_LLVM_MK_VERSION} LLVM_PREFIX= ${_LLVM_MK_PREFIX} +. if empty(_LLVM_MK_EXPORT:Mnoexport) +CC= ${LLVM_PREFIX}/bin/clang +CXX= ${LLVM_PREFIX}/bin/clang++ +CPP= ${LLVM_PREFIX}/bin/clang-cpp +. endif + .endif