Skip to content

Commit

Permalink
add ccache wrapper
Browse files Browse the repository at this point in the history
SVN-Revision: 32075
  • Loading branch information
John Crispin committed Jun 6, 2012
1 parent 84a8853 commit a53b084
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,12 @@ INSTALL_DATA:=install -m0644
INSTALL_CONF:=install -m0600

ifneq ($(CONFIG_CCACHE),)
TARGET_CC:= ccache $(TARGET_CC)
TARGET_CXX:= ccache $(TARGET_CXX)
TARGET_CC_NOCACHE:=$(TARGET_CC)
TARGET_CXX_NOCACHE:=$(TARGET_CXX)
export TARGET_CC_NOCACHE
export TARGET_CXX_NOCACHE
TARGET_CC:= ccache_cc
TARGET_CXX:= ccache_cxx
HOSTCC:= ccache $(HOSTCC)
endif

Expand Down
10 changes: 10 additions & 0 deletions tools/ccache/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ PKG_CAT:=zcat

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)
define Host/Compile
$(MAKE) CC="$(HOSTCC_NOCACHE)" -C $(HOST_BUILD_DIR)
Expand All @@ -26,6 +31,10 @@ ifneq ($(strip $(shell which ccache >/dev/null && echo found)),found)
-$(MAKE) -C $(HOST_BUILD_DIR) uninstall
$(call Host/Clean/Default)
endef
define Host/Install
$(call Host/Install/Default)
$(call Host/Install/ccache)
endef
else
define Host/Prepare
endef
Expand All @@ -34,6 +43,7 @@ else
define Host/Compile
endef
define Host/Install
$(call Host/Install/ccache)
endef
define Host/Clean
endef
Expand Down
2 changes: 2 additions & 0 deletions tools/ccache/files/ccache_cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec ccache "${TARGET_CC_NOCACHE}" "$@"
2 changes: 2 additions & 0 deletions tools/ccache/files/ccache_cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec ccache "${TARGET_CXX_NOCACHE}" "$@"

0 comments on commit a53b084

Please sign in to comment.