diff options
author | Tom Marshall <tdm@cyngn.com> | 2014-05-16 13:46:24 -0700 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-06 16:33:17 -0700 |
commit | a6b82ecfcf390c6ad0f24f6a9ecff7b657c87042 (patch) | |
tree | 0517c0823c10083af4ac530e69072cc774c3e1b2 /core/combo | |
parent | 2639c5043ed6749e207fe3f51969db7a43cdfff7 (diff) | |
download | build-a6b82ecfcf390c6ad0f24f6a9ecff7b657c87042.zip build-a6b82ecfcf390c6ad0f24f6a9ecff7b657c87042.tar.gz build-a6b82ecfcf390c6ad0f24f6a9ecff7b657c87042.tar.bz2 |
build: Set ccache base to build top
This enables ccache sharing between different build tree paths.
Change-Id: I99636bdd2779a6ccf0649f027e35cf67df44b6ae
Diffstat (limited to 'core/combo')
-rw-r--r-- | core/combo/select.mk | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/core/combo/select.mk b/core/combo/select.mk index df12e7e..967a3b2 100644 --- a/core/combo/select.mk +++ b/core/combo/select.mk @@ -47,3 +47,57 @@ $(combo_var_prefix)STATIC_LIB_SUFFIX := .a # Now include the combo for this specific target. include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk + +ifneq ($(USE_CCACHE),) + # The default check uses size and modification time, causing false misses + # since the mtime depends when the repo was checked out + export CCACHE_COMPILERCHECK := content + + # See man page, optimizations to get more cache hits + # implies that __DATE__ and __TIME__ are not critical for functionality. + # Ignore include file modification time since it will depend on when + # the repo was checked out + export CCACHE_SLOPPINESS := time_macros,include_file_mtime,file_macro + + # Turn all preprocessor absolute paths into relative paths. + # Fixes absolute paths in preprocessed source due to use of -g. + # We don't really use system headers much so the rootdir is + # fine; ensures these paths are relative for all Android trees + # on a workstation. + export CCACHE_BASEDIR := $(ANDROID_BUILD_TOP) + + # Workaround for ccache with clang. + # 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) + endif + ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache + # Check that the executable is here. + ccache := $(strip $(wildcard $(ccache))) + ifdef ccache + ifndef CC_WRAPPER + CC_WRAPPER := $(ccache) + endif + ifndef CXX_WRAPPER + CXX_WRAPPER := $(ccache) + endif + ccache = + endif +endif + +# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars. +ifdef CC_WRAPPER + ifneq ($(CC_WRAPPER),$(firstword $($(combo_var_prefix)CC))) + $(combo_var_prefix)CC := $(CC_WRAPPER) $($(combo_var_prefix)CC) + endif +endif +ifdef CXX_WRAPPER + ifneq ($(CXX_WRAPPER),$(firstword $($(combo_var_prefix)CXX))) + $(combo_var_prefix)CXX := $(CXX_WRAPPER) $($(combo_var_prefix)CXX) + endif +endif |