ccache can save a large amount of compilation time on recurring builds and builds restarted from a clean repository after make clean or git clean. It is well suited for e.g. u-boot and Linux compilation.
Caching the host compiler
Caching "native" builds is easily done by adding in the beginning of your $PATH a special directory, which contains links to ccache to override the usual compiler.
On e.g. Debian this directory is readily available as /usr/lib/ccache, So you can do:
$ export PATH="/usr/lib/ccache:$PATH"
Typical links found in this folder are:
c++ -> ../../bin/ccache
cc -> ../../bin/ccache
g++ -> ../../bin/ccache
gcc -> ../../bin/ccache
Caching the cross compiler
Caching cross-compiled builds can be done in the same way as native builds, provided you create links of the form e.g. arm-linux-gnueabihf-gcc pointing to ccache.
But there is an even more convenient way for those projects, which rely on a $CROSS_COMPILE environment variable (as is the case for e.g. u-boot and Linux). You can prefix the cross compiler with ccache there in e.g. the following way: