Boost logo

Boost-Build :

Subject: [Boost-build] Conditional updating using NOUPDATE
From: Edward Mitchell (erm410_at_[hidden])
Date: 2013-04-24 15:25:00


Hi,

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.

I initially tried using an empty alias when the python script exited
with a non-zero value. However, this did not solve point 1), and targets
that had scrape_flag.h as an implicit dependency failed because they do
not include the build directory in the header search.

I then tried applying the built in NOUPDATE rule (as well as NoUpdate)
when the exit status is non-zero. However, this does not add NOUPDATE to
the output for scrape_flag.h when running with -d+12. The code I am
using to define the target is below:

[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.

Ed


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