From 1e97b2787331c5f4452d8c9a76961a89ec355d9d Mon Sep 17 00:00:00 2001 From: Arnout Vandecappelle Date: Sun, 4 Oct 2015 16:25:32 +0100 Subject: ccache: support changing the output directory When building in a different output directory than the original build, there will currently be a lot of ccache misses because in many cases there is some -I/... absolute path in the compilation. Ccache has an option CCACHE_BASEDIR to substitute absolute paths with relative paths, so they wil be the same in the hash (and in the output). Since there are some disadvantages to this path rewriting, it is made optional as BR2_CCACHE_USE_BASEDIR. It defaults to y because the usefulness of ccache is severely reduced without this option. In addition to CCACHE_BASEDIR, we also substitute away the occurences of $(HOST_DIR) in the calculation of the compiler hash. This is done regardless of the setting of BR2_CCACHE_USE_BASEDIR because it's quite harmless. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Signed-off-by: Peter Korsgaard --- package/gcc/gcc.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'package/gcc') diff --git a/package/gcc/gcc.mk b/package/gcc/gcc.mk index 103cbe17b7..420c4e9b7c 100644 --- a/package/gcc/gcc.mk +++ b/package/gcc/gcc.mk @@ -256,8 +256,10 @@ HOST_GCC_COMMON_CCACHE_HASH_FILES += package/gcc/$(GCC_VERSION)/1000-powerpc-lin endif endif +# _CONF_OPTS contains some references to the absolute path of $(HOST_DIR), +# so substitute those away. HOST_GCC_COMMON_TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE_HASH=\"`\ - printf '%s' $($(PKG)_CONF_OPTS) $(GCC_VERSION) \ + printf '%s' $(subst $(HOST_DIR),@HOST_DIR@,$($(PKG)_CONF_OPTS)) \ | sha256sum - $(HOST_GCC_COMMON_CCACHE_HASH_FILES) \ | cut -c -64 | tr -d '\n'`\" endif # BR2_CCACHE -- cgit v1.2.3