[Scons-users] Mark existing file as up-to-date

Dirk Bächle tshortik at gmx.de
Sun May 11 05:15:22 EDT 2014


Hi Pedro,

On 09.05.2014 10:21, Pedro Inácio wrote:

> @all, Thank you for your feedback.

>

> @William, the default build action is something like

> "foo $IN > $OUT"

> I can think of three situations where SCons flags $OUT to be rebuilt,

> 1. I might change the default build action for something like,

> "echo Building $OUT; foo $IN > $OUT"

> 2. I have recompiled foo, but I know that nothing changes in the output.

> 3. I may have changed input $IN, but I know that nothing changed in

> the output.

>

> In all three situations SCons is right. OUT should be rebuilt.

> However, I would like to have control and be able to tell SCons that

> in all three situations it does not need to rebuild the file.

>


I just had another idea that might help you out. Instead of preventing
SCons from trying to rebuild your files, you could make the action a
"null" build. You could define your action as

$MYFOO $SOURCE > $TARGET

and then set the variable "MYFOO" in your environment either to "foo" as
before, or to a new build script "dummy_foo". The latter would obviously
be doing nothing, so the output files are left untouched.

The drawback of this method would be that you'd get a lot more screen
output. Another point might be the MD5 hash summing for your output
files. If they are rather large ( > 100MB for example), you'll lose some
time since they'd get rehashed on every build attempt.

But apart from that, it might be the solution you're searching for. You
then just have to link a command-line option to how you set "MYFOO", or
set this in your SConstruct manually.

Hope this helps.

Regards,

Dirk



More information about the Scons-users mailing list