[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
Wed May 8 23:01:33 UTC 2013


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.


More information about the freebsd-arch mailing list