Current-Users archive

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

Re: Where does the kernel get built?



Alan Barrett <apb%cequrux.com@localhost> writes:

> On Tue, 29 Nov 2011, D'Arcy Cain wrote:
>>> set either MAKEOBJDIR or MAKEOBJDIRPREFIX in the environment
>>> [...]
>> Better yet, why can't we make it work from mk.conf?  It seems
>> like a wart that every option can be controlled there except
>> this one.
>
> .OBJDIR handling is one of the wartiest parts of make.  By the
> time mk.conf is parsed, make has already decided which .OBJDIR
> to use.

This is not the case, proof follows.

# Evidence 1.

# /tmp/test.mk
.if $(.OBJDIR) == $(.CURDIR)
.OBJDIR: /tmp
.endif
all:; echo $(.OBJDIR)


# checking:

lithium$ pwd
/home/asau
lithium$ make -f /tmp/test.mk 
echo /tmp
/tmp

# Evidence 2.

# /tmp/test-mk.conf.mk
GOT_IT= defined

# /tmp/test-mk-conf.mk
.if $(.OBJDIR) == $(.CURDIR)
.OBJDIR: /tmp
.endif
all:; @echo MAKECONF=$(MAKECONF); echo OBJDIR=$(.OBJDIR); echo GOT_IT=$(GOT_IT)

.include <bsd.init.mk>

# checking
lithium$ pwd
/home/asau
lithium$ make -f /tmp/test-mk-conf.mk MAKECONF=/tmp/test-mk.conf.mk
MAKECONF=/tmp/test-mk.conf.mk
OBJDIR=/tmp
GOT_IT=defined


You can call pwd(1) from "all" target and see that current directory is
exactly as defined by ".OBJDIR".


-- 
HE CE3OH...



Home | Main Index | Thread Index | Old Index