diff --git a/Makefile.inc1 b/Makefile.inc1 index af4fb486404f..7f72092d9966 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -444,7 +444,7 @@ BUILD_ARCH!= uname -p .endif .endif WORLDTMP= ${OBJTREE}${.CURDIR}/tmp -BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin +BPATH= ${CCACHE_WRAPPER_PATH_PFX}${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin STRICTTMPPATH= ${BPATH}:${XPATH} TMPPATH= ${STRICTTMPPATH}:${PATH} diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 4c0029418c77..499f31e4929e 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -82,8 +82,11 @@ PATH:= ${PATH:C,:?${CCACHE_WRAPPER_PATH}(/world)?(:$)?,,g} ${var}:= ${CCACHE_BIN} ${${var}} .endif .endfor -.elif empty(PATH:M*${CCACHE_WRAPPER_PATH}*) +.else +# Need to ensure CCACHE_WRAPPER_PATH is the first in ${PATH} +PATH:= ${PATH:C,:?${CCACHE_WRAPPER_PATH}(/world)?(:$)?,,g} PATH:= ${CCACHE_WRAPPER_PATH}:${PATH} +CCACHE_WRAPPER_PATH_PFX= ${CCACHE_WRAPPER_PATH}: .endif # ${CCACHE_BUILD_TYPE} == "command" # GCC does not need the CCACHE_CPP2 hack enabled by default in devel/ccache. # The port enables it due to ccache passing preprocessed C to clang