Bug 751076 - fix $< and $^ for pymake; r=bsmedberg

This commit is contained in:
Mike Shal 2013-07-09 10:14:16 -04:00
parent 1075e2de0f
commit 766102f43a
2 changed files with 38 additions and 1 deletions

View File

@ -1474,8 +1474,20 @@ class Rule(object):
def getcommands(self, target, makefile):
assert isinstance(target, Target)
# Prerequisites are merged if the target contains multiple rules and is
# not a terminal (double colon) rule. See
# https://www.gnu.org/software/make/manual/make.html#Multiple-Targets.
prereqs = []
prereqs.extend(self.prerequisites)
return getcommandsforrule(self, target, makefile, self.prerequisites, stem=None)
if not self.doublecolon:
for rule in target.rules:
# The current rule comes first, which is already in prereqs so
# we don't need to add it again.
if rule != self:
prereqs.extend(rule.prerequisites)
return getcommandsforrule(self, target, makefile, prereqs, stem=None)
# TODO: $* in non-pattern rules?
class PatternRuleInstance(object):

View File

@ -0,0 +1,25 @@
# When a target is defined multiple times, the prerequisites should get
# merged.
default: foo bar baz
foo:
test "$<" = "foo.in1"
@echo TEST-PASS
foo: foo.in1
bar: bar.in1
test "$<" = "bar.in1"
test "$^" = "bar.in1 bar.in2"
@echo TEST-PASS
bar: bar.in2
baz: baz.in2
baz: baz.in1
test "$<" = "baz.in1"
test "$^" = "baz.in1 baz.in2"
@echo TEST-PASS
foo.in1 bar.in1 bar.in2 baz.in1 baz.in2: