Index: toolchain/gcc/Config.in =================================================================== --- toolchain/gcc/Config.in (revision 4317) +++ toolchain/gcc/Config.in (working copy) @@ -47,3 +47,9 @@ Build/install c++ compiler and libstdc++? +config USE_CCACHE + bool + prompt "Use ccache if installed on system" + default u + help + If ccache is installed on the buildhost make the links to it from the cross compiler so that we can take advantage of it. Index: toolchain/gcc/Makefile =================================================================== --- toolchain/gcc/Makefile (revision 4317) +++ toolchain/gcc/Makefile (working copy) @@ -44,8 +44,8 @@ BUILD_DIR1:=$(TOOL_BUILD_DIR)/gcc-$(PKG_VERSION)-initial BUILD_DIR2:=$(TOOL_BUILD_DIR)/gcc-$(PKG_VERSION)-final +ccache := $(shell which ccache) - define Stage1/Configure mkdir -p $(BUILD_DIR1) (cd $(BUILD_DIR1); rm -f config.cache; PATH=$(TARGET_PATH) \ @@ -107,6 +107,17 @@ $(GNU_TARGET_NAME)$${app##$(REAL_GNU_TARGET_NAME)}; \ done; \ ); + ifeq ($(CONFIG_USE_CCACHE),y) + ifneq (,$(ccache)) + set -e; \ + (cd $(STAGING_DIR); \ + cd usr/bin ; \ + for app in gcc c++ g++; do \ + ln -sf $(ccache) $$(app) \ + done; \ + ); + endif + endif endef define Build/Prepare Index: rules.mk =================================================================== --- rules.mk (revision 4317) +++ rules.mk (working copy) @@ -35,8 +35,8 @@ REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux -KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc- -TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc- +KERNEL_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc- +TARGET_CROSS:=$(OPTIMIZE_FOR_CPU)-linux-uclibc- IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH) TARGET_PATH:=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin