From owner-freebsd-toolchain@FreeBSD.ORG Tue May 7 21:56:03 2013 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C96A2365; Tue, 7 May 2013 21:56:03 +0000 (UTC) (envelope-from sjg@juniper.net) Received: from exprod7og114.obsmtp.com (exprod7og114.obsmtp.com [64.18.2.215]) by mx1.freebsd.org (Postfix) with ESMTP id 8F112369; Tue, 7 May 2013 21:56:03 +0000 (UTC) Received: from P-EMHUB02-HQ.jnpr.net ([66.129.224.36]) (using TLSv1) by exprod7ob114.postini.com ([64.18.6.12]) with SMTP ID DSNKUYl4bIyd/dlF2UjbXe53MXGPnvrltLcO@postini.com; Tue, 07 May 2013 14:56:03 PDT Received: from magenta.juniper.net (172.17.27.123) by P-EMHUB02-HQ.jnpr.net (172.24.192.33) with Microsoft SMTP Server (TLS) id 8.3.213.0; Tue, 7 May 2013 14:31:22 -0700 Received: from chaos.jnpr.net (chaos.jnpr.net [172.24.29.229]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id r47LVIL03572; Tue, 7 May 2013 14:31:20 -0700 (PDT) (envelope-from sjg@juniper.net) Received: from chaos.jnpr.net (localhost [127.0.0.1]) by chaos.jnpr.net (Postfix) with ESMTP id 5277F58097; Tue, 7 May 2013 14:31:18 -0700 (PDT) To: Garrett Cooper Subject: Re: [RFC] adding a variable to .mk and Makefile.inc1 to point to top of the FreeBSD source tree In-Reply-To: References: Comments: In-reply-to: Garrett Cooper message dated "Tue, 07 May 2013 13:05:07 -0700." From: "Simon J. Gerraty" X-Mailer: MH-E 7.82+cvs; nmh 1.3; GNU Emacs 22.3.1 Date: Tue, 7 May 2013 14:31:18 -0700 Message-ID: <20130507213118.5277F58097@chaos.jnpr.net> MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-toolchain@freebsd.org, "freebsd-arch@FreeBSD.org Arch" X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 May 2013 21:56:03 -0000 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.