#
# $FreeBSD: ports/devel/ccache/files/ccache-howto-freebsd.txt.in,v 1.11 2006/03/21 15:06:15 ale Exp $
#

To use ccache add the following to /etc/make.conf

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.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.

--

Ccache has installed links for the following compilers
cc c++ gcc g++ gcc295 gcc32 gcc33 gcc34 gcc40 gcc41 gcc42 g++295 g++32 g++33 g++34 g++40 g++41 g++42
in /usr/local/libexec/ccache

!!! 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/libtool15 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"
