Subject: Re: .mk "subroutine" for getting objdir locations
To: Todd Vierling <>
From: Simon J. Gerraty <>
List: tech-toolchain
Date: 08/07/2001 10:28:35
>.elif defined(MAKEOBJDIR)

>if exists(${GETOBJ_SRC}/${MAKEOBJDIR})

This one will not always be correct.  Our make does var substitution on
MAKEOBJDIR* and if MAKEOBJDIR is an absolute path, it uses that.
I use this in a number of my trees btw.  So that 
/path/src/usr.bin/cat has
/path/obj/usr.bin/cat as its object directory.

You can put something like this in a top-level

.ifndef SRCTOP
SRCTOP!= cd ${.PARSEDIR}; pwd
.ifndef OBJTOP
# etc

Once you have SRCTOP and OBJTOP you can use these to refer to other locations
within the tree.  There are a bunch of other useful vars you can derrive using 
SRCTOP and .CURDIR such as the sub-dir portion of .CURDIR, the relative
path from .CURDIR to SRCTOP (probably just .PARSEDIR, but...)