[RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree

Warner Losh imp at bsdimp.com
Wed May 8 03:25:48 UTC 2013


On May 7, 2013, at 3:31 PM, Simon J. Gerraty wrote:

> 
> On Tue, 7 May 2013 13:05:07 -0700, Garrett Cooper writes:
>>   A common pattern that I've seen at Isilon and something else that I've
>> wanted to have for a while is the ability to designate where the top of a
>> source tree was. This is important and helpful when dealing with source
>> files that build upon each other or depend on sources located in other
> 
> FWIW I've done this in the projects/bmake branch.
> 
> SRCTOP is the top of the src tree
> OBJTOP is the top of the corresponding obj tree
> OBJROOT is a common prefix (allows one to deduce where objects for a
> 	different value of $MACHINE will be).

where does MAKEOBJDIRPREFIX come into play?

> $ make -V '${SRCTOP OBJROOT OBJTOP .CURDIR .OBJDIR:L:@v@$v=${$v}@:ts\n}'
> SRCTOP=/b/sjg/work/FreeBSD/projects-bmake/src
> OBJROOT=/var/obj/projects-bmake/
> OBJTOP=/var/obj/projects-bmake/amd64
> .CURDIR=/b/sjg/work/FreeBSD/projects-bmake/src/bin/cat
> .OBJDIR=/var/obj/projects-bmake/amd64/bin/cat
> $
> 
> SRCTOP is simple to derrive from where sys.mk is found
> and the others can be deduced from that
> 
> SRCTOP:= ${.PARSEDIR:H:H:tA}
> OBJROOT?= ${SRCTOP:H}/obj/
> OBJTOP?= ${OBJROOT}${MACHINE}
> 
> though since FreeBSD builds more than one MACHINE_ARCH per MACHINE (in
> some cases), 
> 
> OBJTOP?= ${OBJROOT}${MACHINE_ARCH}
> 
> might make sense.

We do it both ways: on some architectures we have multiple MACHINE_ARCHes per MACHINE (like mips and arm) and on others we have one MACHINE_ARCH and mutliple machines (like i386 and pc98).

We currently use ${MACHINE}.${MACHINE_ARCH} for cross builds, which works out nicely. For historical reasons that turn out to be inconvenient, we don't do this for native builds.

> For Junos we had the opposite - multiple MACHINEs with same
> MACHINE_ARCH.
> 
> I'm currently teaking projects-bmake so it can do the equivalent of
> universe so if more than one MACHINE_ARCH is possiblem the OBJTOP ends
> up being
> 
> OBJTOP= ${OBJROOT}${MACHINE}-${MACHINE_ARCH}
> 
> but for cases like i386, amd64 you just get 
> 
> OBJTOP= ${OBJROOT}${MACHINE}
> 
> as above.

Why is this gratuitously different than the current scheme? Also, how would I build a pc98 build with this? And why have it be different for different architectures? The differences like these (although maybe not this one) make things harder to script for things like nanobsd that reach into the object tree, though the OBJTOP might be enough to solve that.

Warner



More information about the freebsd-arch mailing list