Boost logo

Boost-Build :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-08-12 15:46:24


Ray Lambert wrote:
>> As for 'files modified by external conditions', I believe Boost Build
>> assumes it knows about all dependencies between targets. To give it that
>> have you tries modeling your tools using Boost Build target or generator?
> I've tried a few things like this but I haven't successfully gotten it to
> work. It may just be due to me not understanding the internals enough to
> "press the right buttons" (so to speak).
> I need to run an external tool to "sense" the external condition and I
> haven't found a way to directly translate that into something that effects
> what gets built (i.e. build foo if it's out of date OR if condition X is
> true).

Would something like this solve your problem?

import modules ;

actions quietly do-nothing

# creates a target which will be updated iff condition
# evaluates to true.
rule condition ( name : condition ? )
    if ! $(condition)
        # create a blank target which is always up to date
        alias $(name) ;
        # create a target which will always be out of date
        # because the updating action never creates the
        # corresponding file
        make $(name) : : @do-nothing ;

# Note that this test can be anything
if --rebuild-foo in [ modules.peek : ARGV ]
    rebuild-foo = true ;

condition foo-cond : $(rebuild-foo) ;

exe foo : a.cpp : <dependency>foo-cond ;

In Christ,
Steven Watanabe

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at