Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2013 15:53:02 -0700
From:      "Simon J. Gerraty" <sjg@juniper.net>
To:        Warner Losh <imp@bsdimp.com>
Cc:        Garrett Cooper <yanegomi@gmail.com>, 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:  <20130508225302.DF7AE58097@chaos.jnpr.net>
In-Reply-To: <9CD1CE3E-C17C-4C63-BA03-190531185D7A@bsdimp.com>
References:  <CAGH67wS21otQr1fBqQ2z=XQjUV30QUjdtyAkzC_Tf1Ts%2BPq%2B8g@mail.gmail.com> <20130507213118.5277F58097@chaos.jnpr.net> <D6BADC3E-CCC4-4D85-8857-FB6BAAFBB820@bsdimp.com> <20130508054121.DCA7258097@chaos.jnpr.net> <9CD1CE3E-C17C-4C63-BA03-190531185D7A@bsdimp.com>

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

On Wed, 8 May 2013 15:49:12 -0600, Warner Losh writes:
>> MAKEOBJDIR=3D'${.CURDIR:S,${SRCTOP},${OBJTOP},}'
>>=20
>> which gives you a similar - but much neater result than
>> MAKEOBJDIRPREFIX.
>
>Isn't that backwards. MAKEOBJDIRPREFIX in today's FreeBSD is much more =
>like OBJTOP than what you've quoted here. That's how I set the top of =

No. MAKEOBJDIRPREFIX gives you an objdir by simply doing

${MAKEOBJDIRPREFIX}${.CURDIR}

this is very quick and handy, but the paths can be very long and ugly if
you happen to be on automounted nfs.

For the sake of discussion assume I am in 

/.amd/server/b/sjg/work/FreeBSD/current/src/bin/cat

MAKEOBJDIRPREFIX=/var/obj/current/$MACHINE make -V .OBJDIR
/var/obj/current/amd64/.amd/server/b/sjg/work/FreeBSD/current/src/bin/cat

MAKEOBJDIR='${.CURDIR:S,${SRCTOP},${OBJTOP},}' make -V .OBJDIR
/var/obj/current/amd64/bin/cat

(assuming of course that OBJTOP='${OBJROOT}${MACHINE}' as previously
mentioned).

The ability to do the above is something I added to NetBSD's make ages
ago because we found that MAKEOBJDIRPREFIX resulted in
pathnames that were blowing the command line limits on FreeBSD 2.x

>the tree today, usually with a 'setenv MAKEOBJDIRPREFIX $HOME/obj' in my =
>.cshrc so it is always active. That way I can just buildworld or =

Yes, MAKEOBJDIRPREFIX is certainly very handy - and I use it for quick &
dirty builds and of course for buildworld and such.

>problems with /usr/obj being unwritable...  I know this trick doesn't =
>work for netbsd's make (or didn't years ago when I was building it on a =

What trick?  MAKEOBJDIRPREFIX has always worked as you describe.
Don't confuse limitations imposed by makefiles as being limitations of
the tool ;-)

>The project currently uses dots without issue. Not quite sure why you'd =

The project doesn't currently do anything close to what dirdeps.mk
allows.



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