|
Boost-Build : |
From: Juan Frias (jdanyjavajunkie_at_[hidden])
Date: 2005-07-28 11:11:01
--- In jamboost_at_[hidden], Vladimir Prus <ghost_at_c...> wrote:
> On Thursday 28 July 2005 01:31, JF wrote:
> > Is there a way to get a substring in a Jamfile
> >
> > I noticed there is $(<:S) and $(<:B) to get different parts of a
file
> > but I've got some weird files, for example a source file is named
> > S383.PRO and the compiled version is C383.PRO the number and
extension
> > stays the same but the first letter changes from S -> C any ideas?
>
> You can use the MATCH builtin to extract the part of the string
you're
> interested it, and then add whatever you want. Say (untested code):
>
> local m = [ MATCH S([0-9]*).PRO ] ;
> local new-name = C$(m[1]).PRO ;
Wow, that worked great! Thanks Vladimir!
Just for posterity I used
rule sourceToBin
{
local result = ;
local x ;
local m ;
for x in $(>)
{
m = [ MATCH [Ss]([0-9]*).[Pp][Rr][Oo] : $(x) ] ;
result += c$(m[1]).pro ;
}
return $(result) ;
}
test_list = [ sourceToBin : [ GLOB $(SRC_DIR) : s*.pro ] ] ;
echo $(test_list) ;
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