# # $FreeBSD: ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v 1.15 2011/03/29 14:15:03 ehaupt Exp $ # To use ccache add the following to /etc/make.conf. You can replace cc and c++ with the compilers of your choice. (remember that only GCC and Clang can build world and kernel) .if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) .if !defined(NOCCACHE) CC:=${CC:C,^cc,/usr/local/libexec/ccache/world/cc,1} CXX:=${CXX:C,^c\+\+,/usr/local/libexec/ccache/world/c++,1} .endif .endif For Korn/Bourne shells Add the following to /etc/profile: export PATH=/usr/local/libexec/ccache:$PATH export CCACHE_PATH=/usr/bin:/usr/local/bin For csh/tcsh Add the following to /etc/csh.cshrc: setenv PATH /usr/local/libexec/ccache:$PATH setenv CCACHE_PATH /usr/bin:/usr/local/bin For icc users: Add /usr/local/intel_cc_80/bin to CCACHE_PATH -- To use distcc: For Korn/Bourne shells Add the following to /etc/profile: export CCACHE_PREFIX=distcc export DISTCC_HOSTS="localhost host1 host2" For csh/tcsh Add the following to /etc/csh.cshrc: setenv CCACHE_PREFIX distcc setenv DISTCC_HOSTS "localhost host1 host2" -- If you have a problem building world define NOCCACHE and try again. If you have a problem building a port reset PATH=$CCACHE_PATH and try again. -- Make sure you run 'ccache-update-links' after you install/uninstall additional compiers in order to create/remove compiler links. Clang will return a lot of 'unused argument' warnings: they are harmless. Just add this to /etc/make.conf if you want to hide them: .if ${CC:T} == "clang" CFLAGS+= -Qunused-arguments .endif !!! WARNING !!! Please make sure you have the compiler installed before you do this or your build will fail because it will not be able to find the compiler. Any time you change CC/CXX you need to reinstall devel/libtool or you will run in to problems. -- Ccache's default cache size is 1GB and this is larger than the default size of the root partition (/) on FreeBSD. To over come this you may specify a new cache location on a different partition with the following examples. For Korn/Bourne shells Add the following to /etc/profile: export CCACHE_DIR=/usr/.ccache For csh/tcsh Add the following to /etc/csh.cshrc setenv CCACHE_DIR "/usr/.ccache"