The following is a step by step guide to how to enable and use ccache on FreeBSD 7.1:
- % su
- # cd /usr/ports/devel/ccache
- # make install clean
- # vim /etc/make.conf
.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)Basically we've started by installing ccache (steps 1 through 3) and proceeded by editing /etc/make.conf as to enable ccache on builds.
CC=/usr/local/libexec/ccache/world-cc
CXX=/usr/local/libexec/ccache/world-c++
.endif
Now we need to update the environment.
If you are using csh/tcsh shell add the following to /root/.cshrc:
setenv PATH /usr/local/libexec/ccache:$PATHIf you are using zsh add the following to your /root/.zshrc file:
setenv CCACHE_PATH /usr/bin:/usr/local/bin
setenv CCACHE_DIR /var/tmp/ccache
setenv CCACHE_LOGFILE /var/log/ccache.log
export PATH=/usr/local/libexec/ccache:$PATHAfter updating the dotfiles we update the environment. Users of csh/tcsh shells can update by:
export CCACHE_PATH=/usr/bin:/usr/local/bin
export CCACHE_DIR=/var/tmp/ccache
export CCACHE_LOGFILE=/var/log/ccache.log
- # source /root/.cshrc
- # source /root/.zshrc
To display statistics summary:
- % ccache -s
- % ccache -z
- % ccache -h
- # make NOCCACHE=yes install clean
- % man ccache
- % ccache -h
- % less /ur/local/share/doc/ccache/ccache-howto-freebsd.txt
- % links /ur/local/share/doc/ccache/index.html
- http://forums.freebsd.org/showthread.php?t=174
2 comments:
I noticed in your make.conf settings, you have the variable "NOCCACHE" used in the define but on the command line you're using "NO_CACHE". A grep for NO_CACHE in /usr/ports/Mk/* returns 0 results. Is one of these a typo?
Yep you're right ;)
It should read make NOCCACHE=yes as the port's own documentation states. I've fixed the post.
Thanks for the feedback.
Post a Comment