From 55aad0866382e89a18d5cc49ce2c88c839b88cea Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Sat, 12 Mar 2011 13:19:01 +0100 Subject: [PATCH] Allow win_sdk build with USE_CCACHE=1 This patch allows the Window sdk build (lunch sdk-eng; make win_sdk) to work properly when USE_CCACHE is defined in the environment. There is no Windows ccache prebuilt, but since we're cross-compiling from Linux, detect it and use the linux prebuilt binary instead. Note: Depends on https://review.source.android.com//#change,21755 for a complete solution to the problem. Change-Id: I0b1b59efae86ee7114225258c9ecf9f257913347 --- core/combo/select.mk | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/core/combo/select.mk b/core/combo/select.mk index c8863424a4..d486255717 100644 --- a/core/combo/select.mk +++ b/core/combo/select.mk @@ -62,13 +62,23 @@ $(combo_target)PRELINKER_MAP := $(BUILD_SYSTEM)/prelink-$(combo_os_arch).map include $(BUILD_COMBOS)/$(combo_target)$(combo_os_arch).mk ifneq ($(USE_CCACHE),) - ccache := prebuilt/$(HOST_PREBUILT_TAG)/ccache/ccache - # prepend ccache if necessary - ifneq ($(ccache),$(firstword $($(combo_target)CC))) - $(combo_target)CC := $(ccache) $($(combo_target)CC) + 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-$(BUILD_ARCH) endif - ifneq ($(ccache),$(firstword $($(combo_target)CXX))) - $(combo_target)CXX := $(ccache) $($(combo_target)CXX) + ccache := prebuilt/$(CCACHE_HOST_TAG)/ccache/ccache + # Check that the executable is here. + ccache := $(strip $(wildcard $(ccache))) + ifdef ccache + # prepend ccache if necessary + ifneq ($(ccache),$(firstword $($(combo_target)CC))) + $(combo_target)CC := $(ccache) $($(combo_target)CC) + endif + ifneq ($(ccache),$(firstword $($(combo_target)CXX))) + $(combo_target)CXX := $(ccache) $($(combo_target)CXX) + endif + ccache = endif - ccache = endif