tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make: modifier to run realpath() on variable?



Sorry, I missed this.

On Thu, 15 Apr 2010 08:35:44 +0000, David Holland writes:
>On Wed, Apr 14, 2010 at 02:03:50PM -0700, Simon J. Gerraty wrote:
> > The next version of bmake will have a dependency on realpath()
> > so I'd like to be able to replace things like:
> > 
> > ${.PARSEDIR:C,.*,cd & \&\& 'pwd',:sh}
> > 
> > which is expensive if you have to do it 200k times
> > with:
> > 
> > ${.PARSEDIR:tA}
> > 
> > to convert .PARSEDIR to an absolute path.
>
>Sounds like a good idea to me.
>
>I generally recommend writing makefiles to never use absolute paths,
>but that's not always possible.

I agree, and I've done evil[TM] things in the past to force .CURDIR to
be a relative path ;-) However absolute paths can be very handy when
trying to trim or otherwise canonicalize.

Eg if you have

_PARSEDIR = ${.PARSEDIR:tA}

and you have a makefile.inc at the top of your src tree it can do
neat things like:

SRCTOP := ${_PARSEDIR}
RELDIR = ${.CURDIR:S,${SRCTOP}/,,}

of course there are other ways of skinning that cat...

>Did I ever propose ${.PARSEDIR:<<} and ${.PARSEDIR:>>} for helping to
>navigate with relative paths?

I haven't seen a proposal - what would be the idea?

--sjg


Home | Main Index | Thread Index | Old Index