diff options
author | Bryan Drewery <bdrewery@FreeBSD.org> | 2017-08-01 16:15:08 +0000 |
---|---|---|
committer | Bryan Drewery <bdrewery@FreeBSD.org> | 2017-08-01 16:15:08 +0000 |
commit | e2a659ea64785f143ea224e90164adf0f9112f02 (patch) | |
tree | 82ac41696caa09a029180162ac3a5b0a4ebea67d /share/mk/bsd.compiler.mk | |
parent | 6f4c1b61b2f0e223e67a2962206daaf26c2b4723 (diff) | |
download | src-e2a659ea64785f143ea224e90164adf0f9112f02.tar.gz src-e2a659ea64785f143ea224e90164adf0f9112f02.zip |
CCACHE_BUILD: Allow setting CCACHE_BUILD_TYPE=wrapper.
This uses the /usr/local/libexec/ccache/<cc,c++> wrappers rather than
modifying CC to be '/usr/local/bin/ccache cc'. Some forms of compilation
do not support the 'command' type.
Sponsored by: Dell EMC Isilon
Notes
Notes:
svn path=/head/; revision=321880
Diffstat (limited to 'share/mk/bsd.compiler.mk')
-rw-r--r-- | share/mk/bsd.compiler.mk | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 7cb40bcd376b..4c0029418c77 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -31,6 +31,9 @@ __<bsd.compiler.mk>__: .include <bsd.opts.mk> +# command = /usr/local/bin/ccache cc ... +# wrapper = /usr/local/libexec/ccache/cc ... +CCACHE_BUILD_TYPE?= command # Handle ccache after CC is determined, but not if CC/CXX are already # overridden with a manual setup. .if ${MK_CCACHE_BUILD:Uno} == "yes" && \ @@ -65,19 +68,23 @@ CCACHE_COMPILERCHECK?= content CCACHE_COMPILERCHECK?= mtime .endif .export CCACHE_COMPILERCHECK -# Remove ccache from the PATH to prevent double calls and wasted CPP/LD time. -PATH:= ${PATH:C,:?${CCACHE_WRAPPER_PATH}(/world)?(:$)?,,g} # Ensure no bogus CCACHE_PATH leaks in which might avoid the in-tree compiler. .if !empty(CCACHE_PATH) CCACHE_PATH= .export CCACHE_PATH .endif +.if ${CCACHE_BUILD_TYPE} == "command" +# Remove ccache from the PATH to prevent double calls and wasted CPP/LD time. +PATH:= ${PATH:C,:?${CCACHE_WRAPPER_PATH}(/world)?(:$)?,,g} # Override various toolchain vars. .for var in CC CXX HOST_CC HOST_CXX .if defined(${var}) && ${${var}:M${CCACHE_BIN}} == "" ${var}:= ${CCACHE_BIN} ${${var}} .endif .endfor +.elif empty(PATH:M*${CCACHE_WRAPPER_PATH}*) +PATH:= ${CCACHE_WRAPPER_PATH}:${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 # which fails with -Wparentheses-equality, -Wtautological-compare, and |