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:
parent
41afb96f25
commit
95d4e64a11
1 changed files with 2 additions and 1 deletions
3
redo.py
3
redo.py
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue