Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83973?usp=email )
Change subject: toolchain: Add support for sccache ......................................................................
toolchain: Add support for sccache
sccache (https://github.com/mozilla/sccache) is a compiler caching tool similar to ccache. It has support for multiple cloud and networked storage backends. This could come in handy so that multiple build servers share a cache.
It also supports distributed compilation through automatic packaging of local toolchains. This might come in handy to scale the builder infrastructure on demand more easily.
Change-Id: Ia28e696dfe9eab0fc73ba8c7c6bdfc90cbdb790e Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M Makefile.mk M src/Kconfig M toolchain.mk 3 files changed, 30 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/73/83973/1
diff --git a/Makefile.mk b/Makefile.mk index e9ad2cc..d34bcf9 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -83,6 +83,10 @@ printf "\nccache statistics\n"; \ $(CCACHE) --show-log-stats -v; \ fi + if [ -n "$(SCCACHE)" ]; then \ + printf "\nsccace statistics\n"; \ + $(SCCACHE) --show-stats; \ + fi
# This is intended to run at the *very end* of the build to show warnings # notices and the like. If another target needs to be added, add it diff --git a/src/Kconfig b/src/Kconfig index ef3c72c..7f6fdf1 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -116,6 +116,16 @@
For details see https://ccache.samba.org.
+config SCCACHE + bool "Use sccache to speed up (re)compilation" + help + Enables the use of sccache for faster builds. + + Requires the sccache utility in your system $PATH. + + For details see https://github.com/mozilla/sccache. + + config IWYU bool "Test platform with include-what-you-use" help diff --git a/toolchain.mk b/toolchain.mk index f985e88..2e7674d 100644 --- a/toolchain.mk +++ b/toolchain.mk @@ -19,6 +19,22 @@ HOSTCXX:=$(CCACHE) $(HOSTCXX) endif
+# ccache integration +ifeq ($(CONFIG_SCCACHE),y) + +SCCACHE:=$(word 1,$(wildcard $(addsuffix /sccache,$(subst :, ,$(PATH))))) +ifeq ($(SCCACHE),) +$(error sccache selected, but not found in PATH) +endif + +$(foreach arch,$(ARCH_SUPPORTED), \ + $(eval CC_$(arch):=$(SCCACHE) $(CC_$(arch)))) + +HOSTCC:=$(SCCACHE) $(HOSTCC) +HOSTCXX:=$(SCCACHE) $(HOSTCXX) +endif + + # scan-build integration ifneq ($(CCC_ANALYZER_OUTPUT_FORMAT),)