aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2012-06-06 13:27:11 +0000
committerJohn Crispin <blogic@openwrt.org>2012-06-06 13:27:11 +0000
commite84fbcf5bc52dbeb2f8459d7ce25b61e6ce90fe5 (patch)
treedeed598b50e65f1e706caa3c581fd80570626fdf
parent3cb13b3da5f6c43e256c764e4dc1964a1d312241 (diff)
downloadupstream-e84fbcf5bc52dbeb2f8459d7ce25b61e6ce90fe5.tar.gz
upstream-e84fbcf5bc52dbeb2f8459d7ce25b61e6ce90fe5.tar.bz2
upstream-e84fbcf5bc52dbeb2f8459d7ce25b61e6ce90fe5.zip
[tools] add ccache wrapper
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32075 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--rules.mk8
-rw-r--r--tools/ccache/Makefile10
-rwxr-xr-xtools/ccache/files/ccache_cc2
-rwxr-xr-xtools/ccache/files/ccache_cxx2
4 files changed, 20 insertions, 2 deletions
diff --git a/rules.mk b/rules.mk
index f6e748c429..73a015e7a0 100644
--- a/rules.mk
+++ b/rules.mk
@@ -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
diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile
index 9bc0b5901a..8848fa5102 100644
--- a/tools/ccache/Makefile
+++ b/tools/ccache/Makefile
@@ -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)
@@ -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
@@ -34,6 +43,7 @@ else
define Host/Compile
endef
define Host/Install
+ $(call Host/Install/ccache)
endef
define Host/Clean
endef
diff --git a/tools/ccache/files/ccache_cc b/tools/ccache/files/ccache_cc
new file mode 100755
index 0000000000..01c4ad42a2
--- /dev/null
+++ b/tools/ccache/files/ccache_cc
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec ccache "${TARGET_CC_NOCACHE}" "$@"
diff --git a/tools/ccache/files/ccache_cxx b/tools/ccache/files/ccache_cxx
new file mode 100755
index 0000000000..cc60eb3a13
--- /dev/null
+++ b/tools/ccache/files/ccache_cxx
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec ccache "${TARGET_CXX_NOCACHE}" "$@"