On 2011-10-28 16:41, Dominic Fandrey wrote:
...
Like that:
.if ${.CURDIR:M/usr/src} || ${.CURDIR:M/usr/src/*}
CC=clang
CXX=clang++
CPP=clang-cpp
NO_WERROR=
WERROR=
.endif

I had hoped that the .ifdef construction from the wiki was dated. I
suppose it's emulating setting CC in the environment instead of in
the make/src.conf.

There are two different problems here.  One is that src.conf is read
relatively late, and only when bsd.own.mk is included.  Therefore,
src.conf is not the right place to put CC, CXX and so on.

The other problem is that the build32 stage uses environment variables
to override CC, CXX, AS and LD for its sub-make (see LIB32WMAKEENV in
Makefile.inc1), adding the necessary flags for 32-bit compilation.

However, since environment variables are in turn overridden by direct
assignments (like via reading make.conf), the 32-bit compilation flags
get lost when you specify any of CC, CXX, AS or LD in make.conf.

This latter problem is what my patch attempts to fix, while changing as
little as possible.

...
I tried CC?=, but that doesn't work, because apparently make always
initializes CC before parsing makefiles.

Yes, that is because make implicitly reads sys.mk, which either defines
CC directly, or through reading make.conf.


...
I didn't try it, though. Your patch works for me.

I would really like to have this in head, and even stable/9.  It makes
it possible to just set CC in make.conf, without .ifdef trickery.  Works
nicely for clang, too. :)

Seconded!

If there aren't any objections, I will commit it this weekend.
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to