Subject: Re: .mk "subroutine" for getting objdir locations
To: None <tv@wasabisystems.com>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-toolchain
Date: 08/07/2001 10:43:22
> You can put something like this in a top-level Makefile.inc:
> 
> .ifndef SRCTOP
> SRCTOP!= cd ${.PARSEDIR}; pwd
> .endif
> .ifndef OBJTOP
> .ifdef MAKEOBJDIRPREFIX
> OBJTOP=${MAKEOBJDIRPREFIX}${SRCTOP}
> .endif
> # etc
> .endif
 
> 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

I meant to point out that the above is only really useful when using
MAKEOBJDIR* since it is based on the premiss that there _is_ an
OBJTOP.

In the trees I spoke of OBJTOP and SRCTOP are set in the environment
and MAKEOBJDIR="\${.CURDIR:S,$SRCTOP,$OBJTOP,}"

I use a wrapper script for make that reads a .env file that sits at
the top of each tree that sets MAKESYSPATH, MAKEOBJDIR etc correctly
for that tree before invoking make.  Very handy for using with Emacs.

--sjg