Apply ASAN/UBSAN Makefile check only for build target

COMPILER_TYPE is not set during cleandir and perhaps other non-build
targets, and a build with ASAN or UBSAN enabled failed with an error
reporting that runtime libraries could not be built.

PR:		260099
Reviewed by:	dim
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32805
This commit is contained in:
Ed Maste 2021-12-07 13:08:02 -05:00
parent ecd8245e0d
commit 2a31cd215d
2 changed files with 2 additions and 2 deletions

View File

@ -185,7 +185,7 @@ SUBDIR.${MK_STATS}+= libstats
${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \
${MACHINE_CPUARCH} == "powerpc")
_libclang_rt= libclang_rt
.elif ${MK_ASAN} != "no" || ${MK_UBSAN} != "no"
.elif (${MK_ASAN} != "no" || ${MK_UBSAN} != "no") && make(all)
.error "Requested build with sanitizers but cannot build runtime libraries!"
.endif

View File

@ -23,7 +23,7 @@ _use_sanitizers= yes
.endif # ${MK_UBSAN} == "yes"
.if !defined(BOOTSTRAPPING) && ${_use_sanitizers} != "no" && \
${COMPILER_TYPE} != "clang"
${COMPILER_TYPE} != "clang" && make(all)
.error "Sanitizer instrumentation currently only supported with clang"
.endif