Standardize NO_CCACHE flag and ccache definitions
Edwin Groothuis
edwin at mavetju.org
Wed Jun 18 12:51:56 UTC 2008
Hello,
Recently I've started to use devel/ccache again (sometimes it takes
a while before you understand how it works) and it works pretty
well, except for some ports which can't be build with it. For example
devel/cmake.
To prevent everybody from having to re-invent the wheel, we could
introduce a NO_CCACHE flag in the affected ports Makefile:
NO_CCACHE=yes
Unfortunately /etc/make.conf is read before the ports Makefile is
read, so this in /etc/make.conf isn't going to work anymore:
.if !defined(NO_CCACHE)
CC=/usr/local/libexec/ccache/cc
CXX=/usr/local/libexec/ccache/c++
CPP=/usr/local/libexec/ccache/cpp
CCACHE_DIR=/usr/local/ccache
.endif
So, what is wisdom? Maybe this:
Having a flag in /etc/make.conf to indicate you want to use
devel/ccache:
WANT_CCACHE=yes
And in the ports Makefile you could have:
NO_CCACHE=yes
And in bsd.port.mk before the inclusion of bsd.gcc.mk:
.if defined(WANT_CCACHE) && !defined(NO_CCACHE)
CC?= ${LOCALBASE}/libexec/ccache/cc
CXX?= ${LOCALBASE}/libexec/ccache/c++
CPP?= ${LOCALBASE}/libexec/ccache/cpp
CCACHE_DIR?= ${LOCALBASE}/ccache
.endif
How about this approach?
Edwin
--
Edwin Groothuis | Personal website: http://www.mavetju.org
edwin at mavetju.org | Weblog: http://www.mavetju.org/weblog/
More information about the freebsd-ports
mailing list