Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Aug 2017 16:15:08 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321880 - head/share/mk
Message-ID:  <201708011615.v71GF8Yg013175@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Tue Aug  1 16:15:08 2017
New Revision: 321880
URL: https://svnweb.freebsd.org/changeset/base/321880

Log:
  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

Modified:
  head/share/mk/bsd.compiler.mk

Modified: head/share/mk/bsd.compiler.mk
==============================================================================
--- head/share/mk/bsd.compiler.mk	Tue Aug  1 16:05:23 2017	(r321879)
+++ head/share/mk/bsd.compiler.mk	Tue Aug  1 16:15:08 2017	(r321880)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708011615.v71GF8Yg013175>