Faster compiling and makepkg with ccache HOWTO
From ArchWiki
There's a wonderful tool for gcc called ccache. You can read about it at their home page.
If you're always compiling the same programs over and over again -- such as trying out several kernel patches, or testing your own development -- then ccache is perfect. While it may take a few seconds longer to compile a program the first time with ccache, subsequent compiles will be much, much faster. Obviously, this won't help everyone.
Anyway, there happens to be an Arch package for ccache in the Extra repository.
pacman -S ccache
Now, to speed up compiling C code, instead of running "gcc" or "g++" by itself, you run "ccache gcc" or "ccache g++". You can configure makepkg to use ccache by adding these lines to your /etc/makepkg.conf:
export CC="ccache gcc" export CPP="ccache cpp" export CXX="ccache g++"
Note: If you are compiling for example KDE you have to disable export CPP and export CXX - it prevents from some errors
If you're compiling your code from the command line, and not building packages, then you'll still want to use ccache to help speed things up so add this to your /home/<user>/.bash_profile
PATH="/usr/lib/ccache/bin:/opt/bin:${PATH}"
Enjoy faster compiling!