|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-08-12 06:36:57
Hi Matt,On Sunday 07 August 2005 14:33, slabman_meathouse wrote:
> I've written a rule to recursively find Jamfiles in a directory
> structure...
>
> rule find-jamfiles ( dir )
> {
> local result ;
>
> # this is actually /all/ items, I only want directories
> directories = [ path.glob $(dir) : * ] ;
> jamfiles = [ path.glob $(directories) : Jamfile ] ;
>
> for local directory in $(directories)
> {
> jamfiles += [ build-components $(directory) ] ;
> }
>
> return $(jamfiles) ;
> }
>
> These jamfiles contain an object target used at a top level to build a lib
> target, so:
>
> local objects ;
> for local j in $(jamfiles)
> {
> local dir = $(j:D) ;
> objects += $(dir)//object_target ;
> }
>
> This assumes that the obj target is called object_target :)
>
> If I then use $(objects) to build a lib. There are 2 main problems here:
>
> 1. find-jamfiles recurses more often than necessary, I want a glob that
> returns all directories, not every file/directory.
You can use the CHECK_IF_FILE builtin to weed out files. Say
[ CHECK_IF_FILE Jamroot ]
will return "true" and
[ CHECK_IF_FILE some_dir ]
will return empty list.
> 2. I need to be able to ensure that the Jamfile that find-jamfiles found
> actually contains the object_target target. I hacked targets.find to return
> nothing (rather than asserting out) if it can't find the requested target.
> Is this bad behaviour?
Sure, it's not OK for mainline for obvious reasons. You can try to adopt the
attached example for your project. For me, running "bjam" in top level
produces:
sub//target not found
sub//foo found
which is consisten with content of sub/Jamfile.
HTH,
Volodya
-- Vladimir Prus http://vladimir_prus.blogspot.com Boost.Build V2: http://boost.org/boost-build2 --Boundary-00=_ZnI/CWsYXxZh7Gb Content-Type: application/x-zip; name="check_for_target.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="check_for_target.zip" [Attachment content not displayed.] --Boundary-00=_ZnI/CWsYXxZh7Gb--
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