pythonwaf

Ignoring some flag changes when deciding to rebuild


I'd like to have a C define that represents the timestamp at which my program was last built. For example, something like this:

import time

bld.program (target = "foo",
             source = [ "src/foo.c" ],
             defines = [ time.strftime ('BUILD_TIMESTAMP="%Y/%m/%d %H:%M:%S"') ])

But I don't want the program to be rebuilt when the only thing that changes is the timestamp. With SCons, I could get the effect I want using $( and $) (anything between $( and $) is ignored when computing the hash to decide if something must be rebuilt). Is there something similar in waf?


Solution

  • I'm afraid there nothing like $( $) in waf. Defines are used in the computed hash. There is an example of date/time inclusion in a file in §11.4.1 of the waf book. It's tricky as you not only have to inhibit the processing on date change, but be sure that the file containing the information is rebuilt whenever there is a change in another file :)