Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 May 2013 14:31:18 -0700
From:      "Simon J. Gerraty" <sjg@juniper.net>
To:        Garrett Cooper <yanegomi@gmail.com>
Cc:        freebsd-toolchain@freebsd.org, "freebsd-arch@FreeBSD.org Arch" <freebsd-arch@freebsd.org>
Subject:   Re: [RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree
Message-ID:  <20130507213118.5277F58097@chaos.jnpr.net>
In-Reply-To: <CAGH67wS21otQr1fBqQ2z=XQjUV30QUjdtyAkzC_Tf1Ts%2BPq%2B8g@mail.gmail.com>
References:  <CAGH67wS21otQr1fBqQ2z=XQjUV30QUjdtyAkzC_Tf1Ts%2BPq%2B8g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130507213118.5277F58097>