I have this lines in my /etc/make.conf to control ccache.
If build with ccache is not working I use make -DNOCACHE
Code:
.if ${.CURDIR:M*/devel/ccache}
NOCACHE=1
.endif
.if !defined(NOCACHE)
CC=/usr/local/libexec/ccache/world-cc
CCX=/usr/local/libexec/ccache/world-cc++
.endif