Is there any way to cause scons to force-build all targets when the Sconstruct file itself changes?
(reasoning being that if I change a build setting, I can't rely on a previously built file to be consistent with the new build settings)
Is there any way to cause scons to force-build all targets when the Sconstruct file itself changes?
(reasoning being that if I change a build setting, I can't rely on a previously built file to be consistent with the new build settings)
If you need to add the SConstruct as a dependency of one of your targets then either you are doing it wrong or there is a bug in SCons.
For example if we are talking about the compilation flags. Say you want to change from -O0 to -O2. In the simplest case, you would have:
env = Environment(CCFLAGS = '-O0')
env.Program(target = 'foo', source = 'foo.c')
You run scons, it compiles foo.c to foo.o and creates foo(.exe) from that. And if you change this to:
env = Environment(CCFLAGS = '-O2')
env.Program(target = 'foo', source = 'foo.c')
then scons will rebuild all the targets that are defined in env. This is because the command line is an implicit dependency for a target. So changing the CCFLAGS will change the dependency value, which will rebuild the "foo" target.
Maybe your real question is more like "Why does scons not rebuild my targets even though I have changed the command line options?". Either way you perhaps need to think in terms of the real dependencies involved rather than adding an artificial one to try and force a rebuild.