[RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree
Simon J. Gerraty
sjg at juniper.net
Tue May 7 21:56:03 UTC 2013
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).
$ 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.
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.
More information about the freebsd-arch
mailing list