By default, SCons seems to look at the 'recipe' used to build a program and extracts implicit dependencies from it. For example suppose my SConstruct contains:
Command('foo', 'foocreator.py', '/usr/bin/python foocreator.py > foo')
And I've already built 'foo' ('foo' is up to date). Now I change SConstruct (or more realistically, pass different options) so that the command for 'foo' becomes:
Command('foo', 'foocreator.py', '/usr/bin/qrsh -V -cwd /usr/bin/python foocreator.py > foo')
(In other words, run the foocreator.py script through SGE) Now SCons tries to rebuild foo, --debug=explain tells me that this is because of a "new dependency on /usr/bin/qrsh" and a "dropped dependency on /usr/bin/python").
How can I prevent this inference of dependencies from the recipe, preferably globally? So far I haven't even been able to find a specification of this behaviour. I don't want to have to spell out the fact that 'foo' doesn't really depend on python or qrsh, because I would have to do that for every target and for every possible location of those programs. There must be a "right" way.
EDIT: I have also now tried explicitly adding Ignores for each target, as in:
Ignore('foo', '/usr/bin/python')
Ignore('foo', '/usr/bin/qrsh')
and even this doesn't work! SCons still wants to rebuild everything whenever I switch between running through qrsh and not.
I found the documented solution: there is a construction variable IMPLICIT_COMMAND_DEPENDENCIES which controls exactly this behaviour. It is documented on http://www.scons.org/doc/HTML/scons-man.html (but I discovered it by searching through the scons source code!)
So this gives the behaviour I want based on my original example.
env = Environment(IMPLICIT_COMMAND_DEPENDENCIES =0, ... )
Command('foo', 'foocreator.py', '/usr/bin/python foocreator.py > foo')
(or)
env = Environment(IMPLICIT_COMMAND_DEPENDENCIES =0, ... )
Command('foo', 'foocreator.py', '/usr/bin/python foocreator.py > foo')
I can switch between the two definitions for target 'foo' and scons will not think foo is out of date.