tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Compiler selection support



Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes:

> On Fri, May 27, 2011 at 10:40:04PM +0400, Aleksej Saushev wrote:
>> Joerg Sonnenberger <joerg%britannica.bec.de@localhost> writes:
>> 
>> > Comments?
>> >
>> > Joerg
>> > Index: bsd.own.mk
>> > ===================================================================
>> > RCS file: /home/joerg/repo/netbsd/src/share/mk/bsd.own.mk,v
>> > retrieving revision 1.664
>> > diff -u -p -r1.664 bsd.own.mk
>> > --- bsd.own.mk     9 May 2011 14:36:48 -0000       1.664
>> > +++ bsd.own.mk     17 May 2011 19:36:21 -0000
>> 
>> ...
>> 
>> > +# Duplicated to avoid make bugs
>> > +CC=               ${TOOL_CC.${ACTIVE_CC}}
>> > +CPP=              ${TOOL_CPP.${ACTIVE_CPP}}
>> > +CXX=              ${TOOL_CXX.${ACTIVE_CXX}}
>> > +FC=               ${TOOL_FC.${ACTIVE_FC}}
>> > +OBJC=             ${TOOL_OBJC.${ACTIVE_OBJC}}
>> 
>> These unconditional settings break the code that exists outside NetBSD src.
>> Note that sys.mk does it right:
>> 
>> CC?=         cc
>> CXX?=                c++
>> 
>> It allows overriding compiler in Makefile in a canonical manner (before
>> including bsd.*.mk).
>
> I did consider making the assignment in sys.mk use another level of
> indirection, but rejected it as not useful. The logic as is allows
> compiler selection consistently for both the USETOOLS=no and
> USETOOLS=yes case. I consider that an important feature.

What is the reason to assign variables unconditionally?

On a system before your changes,

$ make -f bsd.prog.mk -V CC
cc
$ CC=/usr/pkg/gcc45/bin/cc make -f bsd.prog.mk -V CC
/usr/pkg/gcc45/bin/cc

system after your changes it becomes:

$ make -m /usr/src/share/mk -f bsd.prog.mk -V CC
${TOOL_CC.${ACTIVE_CC}}
$ CC=/usr/pkg/gcc45/bin/cc make -m /usr/src/share/mk -f bsd.prog.mk -V CC
${TOOL_CC.${ACTIVE_CC}}

Which means that the old way to set variables

CC=/usr/pkg/gcc45/bin/cc
.include "bsd.prog.mk"

doesn't work anymore. Anyone, who happens to use NetBSD mk scripts and
needs newer compiler, has to adapt makefiles or fix bsd.own.mk so that
it honours explicit settings like it did before.


-- 
HE CE3OH...



Home | Main Index | Thread Index | Old Index