Boost logo

Boost-Build :

Subject: Re: [Boost-build] Conditional updating using NOUPDATE
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-04-24 16:23:11


AMDG

On 04/24/2013 12:25 PM, Edward Mitchell wrote:
> Here is a brief overview of my problem. I have a target (scrape_flag.h)
> that I want to update in two cases:
>
> 1) The file does not exist in the build directory.
> 2) A python script that runs at the beginning of the build exits with a
> 0 value.
>
> <snip>
>
> [code]
> rule scrape( dir )
> {
> out = [ SHELL "cd $(dir); export PYTHONPATH=`pwd`:${PYTHONPATH}; python
> $(.common)/symbolScraper.py *.cc *.h" : exit-status ] ;
> local bname = $(dir:B)_scrape_flag.h ;
> if $(out[2]) = 0 {
> ECHO $(out[1]) ;
> } else {
> ECHO "No changes found" ;
> NOUPDATE $(bname) ;
> }
> make $(bname) : : @cando.touch ;
> }
>
> actions touch {
> touch $(<)
> }
> [/code]
>
> Is this the wrong way to use NOUPDATE, or is there a better way to
> approach the problem in general. Thank you for any help you can give me.
>

NOUPDATE is a jam level rule. The correct place to handle
this is:

rule touch ( targets + : sources * : properties * ) {
    if ... {
        NOUPDATE $(targets) ;
    }
}

In Christ,
Steven Watanabe


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