aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-09-11 13:14:38 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2020-09-30 19:09:19 +0200
commit1d14a8edce750c9d87ba6b03276815723de9a193 (patch)
tree62c344b192dcda290f78756d629af87c062663e7 /scripts
parent27d551c00d5458d1deda33508dab7453959ca2c6 (diff)
ninjatool: rebuild multi-output targets if outputs are missing
The "stamp file trick" used to group targets of a single multi-output rule prevents the user from deleting one such target in order to force its rebuild. Doing so will not touch the stamp file, and therefore only the dummy ":" command will be executed. With this patch, ninjatool writes rules that force-rebuild the stamp file if any of its outputs are missing. Rebuilding the missing target therefore causes the stamp file to be rebuilt too. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ninjatool.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/ninjatool.py b/scripts/ninjatool.py
index 627a1cab45..6f0e35c727 100755
--- a/scripts/ninjatool.py
+++ b/scripts/ninjatool.py
@@ -908,6 +908,9 @@ class Ninja2Make(NinjaParserEventsWithVars):
else:
stamp = '%s@%s.stamp' % (rule, sha1_text(targets)[0:11])
self.print('%s: %s; @:' % (targets, stamp))
+ self.print('ifneq (%s, $(wildcard %s))' % (targets, targets))
+ self.print('.PHONY: %s' % (stamp, ))
+ self.print('endif')
self.print('%s: %s | %s; ${ninja-command-restat}' % (stamp, inputs, orderonly))
self.rule_targets[rule].append(stamp)
self.stamp_targets[rule].append(stamp)