I figured I'd share my ccache setup under Ubuntu Linux, in case anyone else wants to use it. (This is based on Darin Fisher's setup, from his ccache post back in 2004.)
sudo apt-get install ccache
Add these to ~/.bashrc:
export CC="ccache gcc"
export CXX="ccache g++"
(Note that "/scratch/work/builds/.ccache" is just an empty directory on the partition where I intend to build Firefox. You'll probably want to replace that with something else -- or you can remove that line to get the default location, $HOME/.ccache)
Then, source that file (to make sure $CCACHE_DIR is defined) and initialize your cache with a largish maximum size (2 gigs):
source ~/.bashrcAnd you're done! The next time you do a "make -f client.mk build", you should see "ccache g++" in place of "g++" in the output, and your .ccache folder should start to grow in size.
ccache -M 2G
I tested ccache's performance by doing an initial build of Firefox trunk (to populate the cache), deleting that build, and then doing a second full build (to make use of the cache). I timed the second build, to see how much the caching helped.
On my work machine, ccache reduced build time from 22 to 11 minutes. And on my home machine, ccache reduced build time from 12 to 4 minutes! (Compare that to multi-hour build times on Windows. :) )