scons uses MD5 hashes rather than file mod times to determine if a dependency needs to be built.
I want this to be the default behavior. But is there any way to force it to assume a particular file is out of date (the equivalent of "touch"), besides editing the file to make it different?
edit: use case:
binary file F is used to create another file G using a tool X. For some reason file G has changed (it got corrupted, or I edited it) or tool X has changed, and I want to recreate file G and everything downstream of it.
edit: This is for occasional use only. I do not want this to happen always, only those few times when I ask for it. Also I may not know the particular file ahead of time. For this reason I do not want to modify the SConscript/SConstruct files to build a particular file. What I would like is to do this at a command prompt:
scons {something to specify file foobar.h}
and that would force scons to build all files depending on foobar.h, whereas just typing scons
would do the regular build using MD5 hashes for dependency checking. I don't mind editing the SConscript/SConstruct files ahead of time to allow this (custom Decider, I guess), if there's a way to do so that doesn't significantly increase the build times.
Have you had a a look at the --interactive option of Scons, there you can clean and build specific targets.
man page describing this.
I don't think there is a way to directly do that. If the source file in question has one obvious output, such as test.o
created from test.c
, then removing test.o
would force a recompile of the source file.
If instead you want to touch test.h
which is included from multiple different source files, you may be better off doing a clean of your whole project to ensure that everything gets rebuilt.
Having said that, you may want to read about the Decider()
function which lets you choose how file dependencies will be treated. You can even choose a custom decider function for particular files in your project, so if you have some global header file that you'd like to be able to touch
and rebuild, you can do that.
Update: To answer your latest question, simply delete the file G. Scons will recreate it from F by running X the next time you build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With