diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2010-12-07 21:09:56 +0100 |
---|---|---|
committer | Peter Korsgaard <jacmet@sunsite.dk> | 2010-12-08 17:51:49 +0100 |
commit | 17b66affdf439ed7c35d2825a1e2bf7967191e14 (patch) | |
tree | 1ca4fdfe4efb06a8a081236c492531d9697e22bf /toolchain | |
parent | 3bbf1c2ea6140d8b288b0af5b1a9c3a1aa92edad (diff) | |
download | buildroot-novena-17b66affdf439ed7c35d2825a1e2bf7967191e14.tar.gz buildroot-novena-17b66affdf439ed7c35d2825a1e2bf7967191e14.zip |
ccache: rework ccache management
* ccache is now a normal package (both for the host and the target).
* ccache option is now part of the "Build options" menu. It will
automatically build ccache for the host before building anything,
and will use it to cache builds for both host compilations and
target compilations.
* bump ccache to 3.1.3
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'toolchain')
-rw-r--r-- | toolchain/ccache/Config.in | 16 | ||||
-rw-r--r-- | toolchain/ccache/Config.in.2 | 13 | ||||
-rw-r--r-- | toolchain/ccache/ccache.mk | 196 | ||||
-rwxr-xr-x | toolchain/dependencies/dependencies.sh | 2 | ||||
-rw-r--r-- | toolchain/toolchain-buildroot.mk | 1 | ||||
-rw-r--r-- | toolchain/toolchain-buildroot/Config.in | 1 | ||||
-rw-r--r-- | toolchain/toolchain-crosstool-ng.mk | 1 | ||||
-rw-r--r-- | toolchain/toolchain-external.mk | 1 | ||||
-rw-r--r-- | toolchain/toolchain-external/ext-tool.mk | 2 |
9 files changed, 2 insertions, 231 deletions
diff --git a/toolchain/ccache/Config.in b/toolchain/ccache/Config.in deleted file mode 100644 index 6f36650c7..000000000 --- a/toolchain/ccache/Config.in +++ /dev/null @@ -1,16 +0,0 @@ -# - -comment "Ccache Options" - -config BR2_CCACHE - bool "Enable ccache support?" - help - Enable ccache support? - -config BR2_CCACHE_DIR - string "ccache dir location?" - depends on BR2_CCACHE - default "$(TOOLCHAIN_DIR)/ccache-$(CCACHE_VER)/cache" - help - Where ccache should store cached files. - diff --git a/toolchain/ccache/Config.in.2 b/toolchain/ccache/Config.in.2 deleted file mode 100644 index 6a6c78915..000000000 --- a/toolchain/ccache/Config.in.2 +++ /dev/null @@ -1,13 +0,0 @@ -# - -config BR2_PACKAGE_CCACHE_TARGET - bool "ccache" - depends on BR2_PACKAGE_GCC_TARGET - help - ccache is a compiler cache. It speeds up recompilation of - C/C++ code by caching previous compiles and detecting when - the same compile is being done again. - - http://ccache.samba.org - - diff --git a/toolchain/ccache/ccache.mk b/toolchain/ccache/ccache.mk deleted file mode 100644 index 8e414b27b..000000000 --- a/toolchain/ccache/ccache.mk +++ /dev/null @@ -1,196 +0,0 @@ -############################################################# -# -# build ccache to make recompiles faster on the build system -# -############################################################# -CCACHE_VER:=2.4 -CCACHE_SITE:=http://samba.org/ftp/ccache -CCACHE_SOURCE:=ccache-$(CCACHE_VER).tar.gz -CCACHE_DIR1:=$(TOOLCHAIN_DIR)/ccache-$(CCACHE_VER) -CCACHE_DIR2:=$(BUILD_DIR)/ccache-$(CCACHE_VER) -CCACHE_CAT:=$(ZCAT) -CCACHE_BINARY:=ccache -CCACHE_TARGET_BINARY:=usr/bin/ccache - -$(DL_DIR)/$(CCACHE_SOURCE): - $(call DOWNLOAD,$(CCACHE_SITE),$(CCACHE_SOURCE)) - -$(CCACHE_DIR1)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE) - $(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) - - touch $@ - -$(CCACHE_DIR1)/.patched: $(CCACHE_DIR1)/.unpacked - # WARNING - this will break if the toolchain is moved. - # Should probably patch things to use a relative path. - $(SED) "s,getenv(\"CCACHE_PATH\"),\"$(STAGING_DIR)/usr/bin-ccache\",g" \ - $(CCACHE_DIR1)/execute.c - # WARNING - this will break if the toolchain build dir is deleted - # when using the default cache dir location. - $(SED) "s,getenv(\"CCACHE_DIR\"),\"$(BR2_CCACHE_DIR)\",g" \ - $(CCACHE_DIR1)/ccache.c - mkdir -p $(CCACHE_DIR1)/cache - $(CONFIG_UPDATE) $(@D) - touch $@ - -$(CCACHE_DIR1)/.configured: $(CCACHE_DIR1)/.patched - mkdir -p $(CCACHE_DIR1) - (cd $(CCACHE_DIR1); rm -rf config.cache; \ - CC="$(HOSTCC)" \ - $(CCACHE_DIR1)/configure $(QUIET) \ - --target=$(GNU_HOST_NAME) \ - --host=$(GNU_HOST_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=/usr \ - $(QUIET) \ - ) - touch $@ - -$(CCACHE_DIR1)/$(CCACHE_BINARY): $(CCACHE_DIR1)/.configured - $(MAKE) CC="$(HOSTCC)" -C $(CCACHE_DIR1) - -$(STAGING_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR1)/$(CCACHE_BINARY) - mkdir -p $(STAGING_DIR)/usr/bin - cp $(CCACHE_DIR1)/ccache $(STAGING_DIR)/usr/bin - # Keep the actual toolchain binaries in a directory at the same level. - # Otherwise, relative paths for include dirs break. - mkdir -p $(STAGING_DIR)/usr/bin-ccache - (cd $(STAGING_DIR)/usr/bin-ccache; \ - ln -fs $(REAL_GNU_TARGET_NAME)-gcc $(GNU_TARGET_NAME)-gcc; \ - ln -fs $(REAL_GNU_TARGET_NAME)-gcc $(GNU_TARGET_NAME)-cc; \ - ln -fs $(REAL_GNU_TARGET_NAME)-gcc $(REAL_GNU_TARGET_NAME)-cc; \ - ) - [ -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc ] && \ - mv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc \ - $(STAGING_DIR)/usr/bin-ccache/ - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs ccache $(GNU_TARGET_NAME)-cc; \ - ln -fs ccache $(GNU_TARGET_NAME)-gcc; \ - ln -fs ccache $(REAL_GNU_TARGET_NAME)-cc; \ - ln -fs ccache $(REAL_GNU_TARGET_NAME)-gcc; \ - ) -ifeq ($(BR2_INSTALL_LIBSTDCPP),y) - [ -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++ ] && \ - mv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++ \ - $(STAGING_DIR)/usr/bin-ccache/ - [ -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-g++ ] && \ - mv $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-g++ \ - $(STAGING_DIR)/usr/bin-ccache/ - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs ccache $(GNU_TARGET_NAME)-c++; \ - ln -fs ccache $(GNU_TARGET_NAME)-g++;\ - ln -fs ccache $(REAL_GNU_TARGET_NAME)-c++; \ - ln -fs ccache $(REAL_GNU_TARGET_NAME)-g++; \ - ) - (cd $(STAGING_DIR)/usr/bin-ccache; \ - ln -fs $(REAL_GNU_TARGET_NAME)-c++ $(GNU_TARGET_NAME)-c++; \ - ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(GNU_TARGET_NAME)-g++; \ - ) -endif - -ccache: gcc $(STAGING_DIR)/$(CCACHE_TARGET_BINARY) - -ccache-clean: - rm -rf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-cc - rm -rf $(STAGING_DIR)/usr/bin/$(GNU_TARGET_NAME)-gcc - rm -rf $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-cc - rm -rf $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc - if [ -f $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-gcc ]; then \ - mv $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-gcc \ - $(STAGING_DIR)/usr/bin/; \ - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs $(REAL_GNU_TARGET_NAME)-gcc \ - $(REAL_GNU_TARGET_NAME)-cc; \ - ln -fs $(REAL_GNU_TARGET_NAME)-gcc \ - $(GNU_TARGET_NAME)-cc; \ - ln -fs $(REAL_GNU_TARGET_NAME)-gcc \ - $(GNU_TARGET_NAME)-gcc; \ - ); \ - fi - if [ -f $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-c++ ]; then \ - rm -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++; \ - mv $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-c++ \ - $(STAGING_DIR)/usr/bin/; \ - fi - if [ -f $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-g++ ]; then \ - rm -f $(STAGING_DIR)/usr/bin/$(REAL_GNU_TARGET_NAME)-g++; \ - mv $(STAGING_DIR)/usr/bin-ccache/$(REAL_GNU_TARGET_NAME)-g++ \ - $(STAGING_DIR)/usr/bin/; \ - fi - rm -rf $(STAGING_DIR)/usr/bin-ccache/* - (cd $(STAGING_DIR)/usr/bin; \ - ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(GNU_TARGET_NAME)-c++; \ - ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(GNU_TARGET_NAME)-g++; \ - ln -fs $(REAL_GNU_TARGET_NAME)-g++ $(REAL_GNU_TARGET_NAME)-c++; \ - ) - -$(MAKE) -C $(CCACHE_DIR1) clean - -ccache-dirclean: - rm -rf $(CCACHE_DIR1) - - - - -############################################################# -# -# build ccache for use on the target system -# -############################################################# - -$(CCACHE_DIR2)/.unpacked: $(DL_DIR)/$(CCACHE_SOURCE) - $(CCACHE_CAT) $(DL_DIR)/$(CCACHE_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) - - touch $@ - -$(CCACHE_DIR2)/.patched: $(CCACHE_DIR2)/.unpacked - touch $@ - -$(CCACHE_DIR2)/.configured: $(CCACHE_DIR2)/.patched - mkdir -p $(CCACHE_DIR2) - (cd $(CCACHE_DIR2); rm -rf config.cache; \ - $(TARGET_CONFIGURE_OPTS) \ - $(CCACHE_DIR2)/configure $(QUIET) \ - --target=$(GNU_TARGET_NAME) \ - --host=$(GNU_TARGET_NAME) \ - --build=$(GNU_HOST_NAME) \ - --prefix=/usr \ - --sysconfdir=/etc \ - $(DISABLE_NLS) \ - $(QUIET) \ - ) - touch $@ - -$(CCACHE_DIR2)/$(CCACHE_BINARY): $(CCACHE_DIR2)/.configured - $(MAKE) -C $(CCACHE_DIR2) CFLAGS="$(TARGET_CFLAGS)" - -$(TARGET_DIR)/$(CCACHE_TARGET_BINARY): $(CCACHE_DIR2)/$(CCACHE_BINARY) - $(MAKE) DESTDIR=$(TARGET_DIR) -C $(CCACHE_DIR2) install - # put a bunch of symlinks into /bin, since that is earlier - # in the default PATH than /usr/bin where gcc lives - (cd $(TARGET_DIR)/bin; \ - ln -fs /usr/bin/ccache cc; \ - ln -fs /usr/bin/ccache gcc; \ - ln -fs /usr/bin/ccache c++; \ - ln -fs /usr/bin/ccache g++; \ - ) - -ccache_target: uclibc $(TARGET_DIR)/$(CCACHE_TARGET_BINARY) - -ccache_target-sources: $(DL_DIR)/$(CCACHE_SOURCE) - -ccache_target-clean: - rm -f $(TARGET_DIR)/$(CCACHE_TARGET_BINARY) \ - $(addprefix $(TARGET_DIR)/bin/,cc gcc c++ g++) - -$(MAKE) -C $(CCACHE_DIR2) clean - -ccache_target-dirclean: - rm -rf $(CCACHE_DIR2) -############################################################# -# -# Toplevel Makefile options -# -############################################################# -ifeq ($(BR2_CCACHE),y) -TARGETS+=ccache -endif -ifeq ($(BR2_PACKAGE_CCACHE_TARGET),y) -TARGETS+=ccache_target -endif diff --git a/toolchain/dependencies/dependencies.sh b/toolchain/dependencies/dependencies.sh index ee21b3780..1aa013f5a 100755 --- a/toolchain/dependencies/dependencies.sh +++ b/toolchain/dependencies/dependencies.sh @@ -79,7 +79,7 @@ if [ $MAKE_MAJOR -lt 3 ] || [ $MAKE_MAJOR -eq 3 -a $MAKE_MINOR -lt 81 ] ; then fi; # Check host gcc -COMPILER=$(which $HOSTCC 2> /dev/null) +COMPILER=$(which $HOSTCC_NOCCACHE 2> /dev/null) if [ -z "$COMPILER" ] ; then COMPILER=$(which cc 2> /dev/null) fi; diff --git a/toolchain/toolchain-buildroot.mk b/toolchain/toolchain-buildroot.mk index d879697e9..44044d749 100644 --- a/toolchain/toolchain-buildroot.mk +++ b/toolchain/toolchain-buildroot.mk @@ -2,7 +2,6 @@ include toolchain/dependencies/dependencies.mk include toolchain/binutils/binutils.mk -include toolchain/ccache/ccache.mk include toolchain/elf2flt/elf2flt.mk include toolchain/gcc/gcc-uclibc-4.x.mk include toolchain/gdb/gdb.mk diff --git a/toolchain/toolchain-buildroot/Config.in b/toolchain/toolchain-buildroot/Config.in index a9dd19240..c45825151 100644 --- a/toolchain/toolchain-buildroot/Config.in +++ b/toolchain/toolchain-buildroot/Config.in @@ -5,5 +5,4 @@ source "toolchain/kernel-headers/Config.in" source "toolchain/uClibc/Config.in" source "toolchain/binutils/Config.in" source "toolchain/gcc/Config.in" -source "toolchain/ccache/Config.in" endif diff --git a/toolchain/toolchain-crosstool-ng.mk b/toolchain/toolchain-crosstool-ng.mk index 81fce1872..1c8030091 100644 --- a/toolchain/toolchain-crosstool-ng.mk +++ b/toolchain/toolchain-crosstool-ng.mk @@ -3,7 +3,6 @@ # Explicit ordering: include toolchain/helpers.mk include toolchain/binutils/binutils.mk -include toolchain/ccache/ccache.mk include toolchain/dependencies/dependencies.mk include toolchain/elf2flt/elf2flt.mk include toolchain/gcc/gcc-uclibc-4.x.mk diff --git a/toolchain/toolchain-external.mk b/toolchain/toolchain-external.mk index 6f1f641ac..f90b6f147 100644 --- a/toolchain/toolchain-external.mk +++ b/toolchain/toolchain-external.mk @@ -2,7 +2,6 @@ include toolchain/helpers.mk include toolchain/binutils/binutils.mk -include toolchain/ccache/ccache.mk include toolchain/dependencies/dependencies.mk include toolchain/elf2flt/elf2flt.mk include toolchain/gcc/gcc-uclibc-4.x.mk diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk index 7e4645ddb..53ad636ac 100644 --- a/toolchain/toolchain-external/ext-tool.mk +++ b/toolchain/toolchain-external/ext-tool.mk @@ -62,7 +62,7 @@ endif # ! no threads # could select a multilib variant as we want the "main" sysroot, which # contains all variants of the C library in the case of multilib # toolchains. -TARGET_CC_NO_SYSROOT=$(filter-out --sysroot=%,$(TARGET_CC)) +TARGET_CC_NO_SYSROOT=$(filter-out --sysroot=%,$(TARGET_CC_NOCCACHE)) SYSROOT_DIR=$(shell $(TARGET_CC_NO_SYSROOT) -print-sysroot 2>/dev/null) ifeq ($(SYSROOT_DIR),) SYSROOT_DIR=$(shell readlink -f $$(LANG=C $(TARGET_CC_NO_SYSROOT) -print-file-name=libc.a) |sed -r -e 's:usr/lib/libc\.a::;') |