Boost logo

Boost-Build :

Subject: Re: [Boost-build] bjam install rule to install a directory hierarchy
From: Mark E. Hamilton (mhamilt_at_[hidden])
Date: 2011-07-14 19:43:49


The eagle-eyed among us will notice an unfortunate typo in my previous
post, cause by incorrectly changing a variable name just before posting
the message. Sorry.

rule glob-tree ( roots * : patterns + : exclude-patterns * : files-only * )
{
     return [ sequence.transform path.make : [ .glob-tree [
sequence.transform
         path.native : $(roots) ] : $(patterns) : $(exclude-patterns) :
$(files-only) ] ] ;
}

local rule .glob-tree ( roots * : patterns * : exclude-patterns * :
files-only * )
{
     local excluded ;
     if $(exclude-patterns)
     {
         excluded = [ GLOB $(roots) : $(exclude-patterns) ] ;
     }
     local result = [ set.difference [ GLOB $(roots) : $(patterns) ] :
$(excluded) ] ;
     local subdirs ;
     for local d in [ set.difference [ GLOB $(roots) : * ] : $(excluded) ]
     {
         if ! ( $(d:D=) in . .. ) && ! [ CHECK_IF_FILE $(d) ]
         {
             subdirs += $(d) ;

             if $(files-only)
               {
               result = [ set.difference $(result) : $(d) ] ;
               }
         }
     }
     if $(subdirs)
     {
         result += [ .glob-tree $(subdirs) : $(patterns) :
$(exclude-patterns) : $(files-only) ] ;
     }
     return $(result) ;
}

-- 
----------------
Mark E. Hamilton
GAITS, Inc.
Sandia National Laboratory, NM.
505-844-7666

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