summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAnthony King <anthonydking@gmail.com>2015-02-08 03:19:03 (GMT)
committerTim Schumacher <timschumi@gmx.de>2018-08-15 17:05:14 (GMT)
commit44dd6cfe9662daef608b5763bbcdfa55c68ee76b (patch)
treed17df6570d73b989183fb67449323ec67188dc1a /core
parent88fccd1fe6d50285224191d2aef8b9ea2fc7cd00 (diff)
downloadbuild-44dd6cfe9662daef608b5763bbcdfa55c68ee76b.zip
build-44dd6cfe9662daef608b5763bbcdfa55c68ee76b.tar.gz
build-44dd6cfe9662daef608b5763bbcdfa55c68ee76b.tar.bz2
build: use the system's ccache by default
* ccache gets updated semi-frequently and some builders would like to be able to take advantage of new features without having to rely on the prebuilt version getting updated * If a build system has ccache installed already, use that version instead of the prebuilt Change-Id: I8988c8a25fab3694d84633f957c2b92ce84cf69e
Diffstat (limited to 'core')
-rw-r--r--core/ccache.mk18
-rw-r--r--core/tasks/kernel.mk11
2 files changed, 20 insertions, 9 deletions
diff --git a/core/ccache.mk b/core/ccache.mk
index d27f5a5..bd60ebf 100644
--- a/core/ccache.mk
+++ b/core/ccache.mk
@@ -38,13 +38,19 @@ ifneq ($(USE_CCACHE),)
# See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
export CCACHE_CPP2 := true
- CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
- # If we are cross-compiling Windows binaries on Linux
- # then use the linux ccache binary instead.
- ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
- CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
+ # Detect if the system already has ccache installed to use instead of the prebuilt
+ ccache := $(shell which ccache)
+
+ ifeq ($(ccache),)
+ CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
+ # If we are cross-compiling Windows binaries on Linux
+ # then use the linux ccache binary instead.
+ ifeq ($(HOST_OS)-$(BUILD_OS),windows-linux)
+ CCACHE_HOST_TAG := linux-$(HOST_PREBUILT_ARCH)
+ endif
+ ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
endif
- ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
+
# Check that the executable is here.
ccache := $(strip $(wildcard $(ccache)))
ifdef ccache
diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk
index de51b74..368e1a3 100644
--- a/core/tasks/kernel.mk
+++ b/core/tasks/kernel.mk
@@ -222,9 +222,14 @@ endif
endif
ifneq ($(USE_CCACHE),)
- ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache
- # Check that the executable is here.
- ccache := $(strip $(wildcard $(ccache)))
+ # Detect if the system already has ccache installed to use instead of the prebuilt
+ ccache := $(shell which ccache)
+
+ ifeq ($(ccache),)
+ ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache
+ # Check that the executable is here.
+ ccache := $(strip $(wildcard $(ccache)))
+ endif
endif
KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)"