Boost logo

Boost-Build :

From: Rene Rivera (grafikrobot_at_[hidden])
Date: 2008-07-22 12:45:06


Jonathan Biggar wrote:
> Jurko Gospodnetic' wrote:

>>> rule add-os-specific-sources ( properties * )
>>> {
>>> local target-os = [ MATCH "^<target-os>(.*)$" : $(properties) ] ;
> >> return
>>> $(target-os)-specific-source-1
>>> $(target-os)-specific-source-2
>>> $(target-os)-specific-source-3
>>> $(target-os)-specific-source-4
>>> $(target-os)-specific-source-5 ;
>>> }
>
> Hmmm. Should that be:
>
> rule add-os-specific-sources ( properties * )
> {
> local target-os = [ MATCH "^<target-os>(.*)$" : $(properties) ] ;
> return
> <source>$(target-os)-specific-source-1
> <source>$(target-os)-specific-source-2
> <source>$(target-os)-specific-source-3
> <source>$(target-os)-specific-source-4
> <source>$(target-os)-specific-source-5 ;
> }
>
> Or am I misunderstanding something?

You understand correctly... But the "faster" way to do that would be:

import property ;

rule add-os-specific-sources ( properties * )
{
   local target-os = [ property.select <target-os> : $(properties) ] ;
   local sources = source1 source2 source3 ;
   return <source>$(target-os:G=)-$(sources).cpp ;
}

And the one I use in such organizations:

import property ;

rule add-os-specific-sources ( properties * )
{
   local target-os = [ property.select <target-os> : $(properties) ] ;
   local sources = [ glob some/dir/$(target-os:G=)-*.cpp ] ;
   return <source>$(sources) ;
}

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org (msn) - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim,yahoo,skype,efnet,gmail

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