Commit 17b66aff authored by Thomas Petazzoni's avatar Thomas Petazzoni Committed by Peter Korsgaard
Browse files

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: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
parent 3bbf1c2e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
2011.02, Not yet released:

	Ccache support reworked. Now used for both host and target
	compilation, and cache is stored in ~/.buildroot-ccache.

	Updated/fixed packages: cloop, m4, openssh, xz

	New packages: lsuio
+8 −0
Original line number Diff line number Diff line
@@ -94,6 +94,14 @@ config BR2_JLEVEL
	help
	  Number of jobs to run simultaneously

config BR2_CCACHE
	bool "Enable compiler cache"
	help
	  This option will enable the use of ccache, a compiler
	  cache. It will cache the result of previous builds to speed
	  up future builds. The cache is stored in
	  $HOME/.buildroot-ccache.

config BR2_DEPRECATED
	bool "Show packages that are deprecated or obsolete"
	help
+20 −6
Original line number Diff line number Diff line
@@ -125,10 +125,13 @@ HOSTAS:=as
endif
ifndef HOSTCC
HOSTCC:=gcc
else
HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
HOSTCC_NOCCACHE:=$(HOSTCC)
endif
ifndef HOSTCXX
HOSTCXX:=g++
HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
HOSTCXX_NOCCACHE:=$(HOSTCXX)
endif
ifndef HOSTFC
HOSTFC:=gfortran
@@ -147,8 +150,6 @@ HOSTNM:=nm
endif
HOSTAR:=$(shell which $(HOSTAR) || type -p $(HOSTAR) || echo ar)
HOSTAS:=$(shell which $(HOSTAS) || type -p $(HOSTAS) || echo as)
HOSTCC:=$(shell which $(HOSTCC) || type -p $(HOSTCC) || echo gcc)
HOSTCXX:=$(shell which $(HOSTCXX) || type -p $(HOSTCXX) || echo g++)
HOSTFC:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo || which g77 || type -p g77 || echo gfortran)
HOSTCPP:=$(shell which $(HOSTCPP) || type -p $(HOSTCPP) || echo cpp)
HOSTLD:=$(shell which $(HOSTLD) || type -p $(HOSTLD) || echo ld)
@@ -156,6 +157,7 @@ HOSTLN:=$(shell which $(HOSTLN) || type -p $(HOSTLN) || echo ln)
HOSTNM:=$(shell which $(HOSTNM) || type -p $(HOSTNM) || echo nm)

export HOSTAR HOSTAS HOSTCC HOSTCXX HOSTFC HOSTLD
export HOSTCC_NOCCACHE HOSTCXX_NOCCACHE

# bash prints the name of the directory on 'cd <dir>' if CDPATH is
# set, so unset it here to not cause problems. Notice that the export
@@ -231,10 +233,15 @@ PREFERRED_LIB_FLAGS:=--enable-static --enable-shared
# along with the packages to build for the target.
#
##############################################################

ifeq ($(BR2_CCACHE),y)
BASE_TARGETS += host-ccache
endif

ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers
BASE_TARGETS += uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers
else
BASE_TARGETS:=uclibc
BASE_TARGETS += uclibc
endif
TARGETS:=

@@ -276,6 +283,13 @@ TARGET_SKELETON=$(TOPDIR)/fs/skeleton

BR2_DEPENDS_DIR=$(BUILD_DIR)/buildroot-config

ifeq ($(BR2_CCACHE),y)
CCACHE:=$(HOST_DIR)/usr/bin/ccache
CCACHE_CACHE_DIR=$(HOME)/.buildroot-ccache
HOSTCC  := $(CCACHE) $(HOSTCC)
HOSTCXX := $(CCACHE) $(HOSTCXX)
endif

include toolchain/Makefile.in
include package/Makefile.in

@@ -480,7 +494,7 @@ export HOSTCFLAGS

$(BUILD_DIR)/buildroot-config/%onf:
	mkdir -p $(@D)/lxdialog
	$(MAKE) CC="$(HOSTCC)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)
	$(MAKE) CC="$(HOSTCC_NOCCACHE)" HOSTCC="$(HOSTCC_NOCCACHE)" obj=$(@D) -C $(CONFIG) -f Makefile.br $(@F)

COMMON_CONFIG_ENV = \
	KCONFIG_AUTOCONFIG=$(BUILD_DIR)/buildroot-config/auto.conf \
+28 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
      <li><a href="#buildroot_innards">How Buildroot works</a></li>
      <li><a href="#using_toolchain">Using the uClibc toolchain outside Buildroot</a></li>
      <li><a href="#external_toolchain">Use an external toolchain</a></li>
      <li><a href="#ccache-support">Using <code>ccache</code> in Buildroot</li>
      <li><a href="#downloaded_packages">Location of downloaded packages</a></li>
      <li><a href="#add_packages">Adding new packages to Buildroot</a></li>
      <li><a href="#board_support">Creating your own board support</a></li>
@@ -523,9 +524,8 @@ $(ZLIB_DIR)/libz.a: $(ZLIB_DIR)/.configured
    <ul>
      <li><b>toolchain</b> (in the <code>toolchain/</code> directory) contains
      the Makefiles and associated files for all software related to the
      cross-compilation toolchain: <code>binutils</code>, <code>ccache</code>,
      <code>gcc</code>, <code>gdb</code>, <code>kernel-headers</code> and
      <code>uClibc</code>.</li>
      cross-compilation toolchain: <code>binutils</code>, <code>gcc</code>,
      <code>gdb</code>, <code>kernel-headers</code> and <code>uClibc</code>.</li>

      <li><b>package</b> (in the <code>package/</code> directory) contains the
      Makefiles and associated files for all user-space tools that Buildroot
@@ -681,6 +681,31 @@ endif
    Build options -&gt; Toolchain and header file location</code> options.
    This could be useful if the toolchain must be shared with other users.</p>

    <h2 id="ccache-support">Using <code>ccache</code> in Buildroot</h2>

    <p><a href="http://ccache.samba.org">ccache</a> is a compiler
    cache. It stores the object files resulting from each compilation
    process, and is able to skip future compilation of the same source
    file (with same compiler and same arguments) by using the
    pre-existing object files. When doing almost identical builds from
    scratch a number of times, it can nicely speed up the build
    process.</p>

    <p><code>ccache</code> support is integrated in Buildroot. You
    just have to enable <code>Enable compiler cache</code>
    in <code>Build options</code>. This will automatically build
    <code>ccache</code> and use it for every host and target
    compilation.</p>

    <p>The cache is located
    in <code>$HOME/.buildroot-ccache</code>. It is stored outside of
    Buildroot output directory so that it can be shared by separate
    Buildroot builds. If you want to get rid of the cache, simply
    remove this directory.</p>

    <p>You can get statistics on the cache (its size, number of hits,
    misses, etc.) by running <code>make ccache-stats</code>.</p>

    <h2 id="downloaded_packages">Location of downloaded packages</h2>

    <p>It might be useful to know that the various tarballs that are
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ source "package/autoconf/Config.in"
source "package/automake/Config.in"
source "package/bison/Config.in"
source "package/bsdiff/Config.in"
source "toolchain/ccache/Config.in.2"
source "package/ccache/Config.in"
if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
source "package/coreutils/Config.in"
endif
Loading