If foo and foo.do exist, then foo is always a target, not a source file.

The problem is if someone accidentally creates a file called "test" *before*
.redo/gen^test got created, then 'redo test' would do nothing, because redo
would assume it's a source file instead of a destination, according to djb's
rule.  But in this case, we know it's not, since test.do exists, so let's
build it anyway.  The problem is related to .PHONY rules in make.

This workaround is kind of cheating, because we can't safely apply that rule
if foo and default.do exist, even though default.do can be used to build
foo.

This probably won't happen very often... except with minimal/do, which
creates these empty files even when it shouldn't.  I'm not sure if I should
try to fix that or not, though.
This commit is contained in:
Avery Pennarun 2010-11-16 03:40:13 -08:00
commit 95d4e64a11

View file

@ -99,7 +99,8 @@ def _preexec(t):
def _build(t): def _build(t):
if os.path.exists(t) and not os.path.exists(sname('gen', t)): if (os.path.exists(t) and not os.path.exists(sname('gen', t))
and not os.path.exists('%s.do' % t)):
# an existing source file that is not marked as a generated file. # an existing source file that is not marked as a generated file.
# This step is mentioned by djb in his notes. It turns out to be # This step is mentioned by djb in his notes. It turns out to be
# important to prevent infinite recursion. For example, a rule # important to prevent infinite recursion. For example, a rule