add ccache wrapper

SVN-Revision: 32075
This commit is contained in:
John Crispin 2012-06-06 13:27:11 +00:00
parent 84a8853430
commit a53b084e49
4 changed files with 20 additions and 2 deletions

View File

@ -188,8 +188,12 @@ INSTALL_DATA:=install -m0644
INSTALL_CONF:=install -m0600 INSTALL_CONF:=install -m0600
ifneq ($(CONFIG_CCACHE),) ifneq ($(CONFIG_CCACHE),)
TARGET_CC:= ccache $(TARGET_CC) TARGET_CC_NOCACHE:=$(TARGET_CC)
TARGET_CXX:= ccache $(TARGET_CXX) TARGET_CXX_NOCACHE:=$(TARGET_CXX)
export TARGET_CC_NOCACHE
export TARGET_CXX_NOCACHE
TARGET_CC:= ccache_cc
TARGET_CXX:= ccache_cxx
HOSTCC:= ccache $(HOSTCC) HOSTCC:= ccache $(HOSTCC)
endif endif

View File

@ -17,6 +17,11 @@ PKG_CAT:=zcat
include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/host-build.mk
define Host/Install/ccache
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin/
$(CP) ./files/* $(STAGING_DIR_HOST)/bin/
endef
ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found) ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
define Host/Compile define Host/Compile
$(MAKE) CC="$(HOSTCC_NOCACHE)" -C $(HOST_BUILD_DIR) $(MAKE) CC="$(HOSTCC_NOCACHE)" -C $(HOST_BUILD_DIR)
@ -26,6 +31,10 @@ ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall -$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default) $(call Host/Clean/Default)
endef endef
define Host/Install
$(call Host/Install/Default)
$(call Host/Install/ccache)
endef
else else
define Host/Prepare define Host/Prepare
endef endef
@ -34,6 +43,7 @@ else
define Host/Compile define Host/Compile
endef endef
define Host/Install define Host/Install
$(call Host/Install/ccache)
endef endef
define Host/Clean define Host/Clean
endef endef

2
tools/ccache/files/ccache_cc Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec ccache "${TARGET_CC_NOCACHE}" "$@"

2
tools/ccache/files/ccache_cxx Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec ccache "${TARGET_CXX_NOCACHE}" "$@"