|
Boost-Build : |
From: Dave Rahardja (drahardja_at_[hidden])
Date: 2007-04-16 01:41:22
> -----Original Message-----
> From: boost-build-bounces_at_[hidden]
> [mailto:boost-build-bounces_at_[hidden]] On Behalf Of Rene Rivera
> Sent: Monday, April 16, 2007 12:04 AM
> To: Boost.Build developer's and user's list
> Subject: Re: [Boost-build] How to get absolute paths?
>
> Rene Rivera wrote:
> > Dave Rahardja wrote:
> >> When writing a toolset definition, how can I get the
> absolute paths of files
> >> passed into rules and actions, instead of their gristed versions?
> >
> > local p = [ on $(target) return $(LOCATE) ] ;
>
> PS. That only gets you the, usually relative, ungristed path to the
> gristed part of the target. You'll have to root it with pwd,
> and append
> the target filename.
I've gotten a little further by using:
rule make-absolute ( paths * : root )
{
local out = ;
for p in $(paths)
{
out += [ path.root $(p) $(root) ] ;
}
return $(out) ;
}
local includes = [ on $(target) return $(INCLUDES) ] ;
includes = [ make-absolute $(includes) : [ path.native [ path.pwd ] ] ] ;
Problem is, $(includes) contains non-minimal path elements, and may look
something like (on Win32):
C:/foo/bar/baz/../../bah
instead of
C:/foo/bah
-dr
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk