|
Boost-Build : |
Subject: Re: [Boost-build] Conditional updating using NOUPDATE
From: Edward Mitchell (erm410_at_[hidden])
Date: 2013-04-25 00:06:12
On 04/24/2013 04:23 PM, Steven Watanabe wrote:
> 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
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Steven,
Thank you for your quick response. However, I am not quite sure that
what you are saying is different from what I am doing.
To be clearer I have several jamfiles that all are `using cando` and
call the rule `cando.scrape` at parse time. This rule, defined in a
toolset module cando.jam, runs the python script and defines the target
that I am having trouble with. I thought that by using a toolset module
the all uppercase (jam level) rules would be available to use, e.g. I
have used "ECHO" and "echo" equally effectively in cando.jam.
Are you saying I need a new main target rule, with a custom file
type/generator and everything to make this work? Or am I missing
something obvious?
To sum up:
In jamfile.jam, I have the lines:
using cando ;
cando.scrape $(__file__:D) ;
always scrape_flag.h ;
And in cando.jam I have the code posted in the previous email.
I am afraid I am terribly confused by all this, I hope you can clear it
up for me.
Thanks,
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