diff options
-rw-r--r-- | yapymake/makefile/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/yapymake/makefile/__init__.py b/yapymake/makefile/__init__.py index 0a272cf..6c7098d 100644 --- a/yapymake/makefile/__init__.py +++ b/yapymake/makefile/__init__.py @@ -144,7 +144,10 @@ class Makefile: special_target_match = re.fullmatch(r'\.[A-Z]+', targets[0]) if len(targets) == 1 and len(prerequisites) == 0 and match is not None and special_target_match is None: # it's an inference rule! - self._inference_rules.append(InferenceRule(match.group('s1'), match.group('s2'), commands)) + new_rule = InferenceRule(match.group('s1'), match.group('s2'), commands) + rules = [r for r in self._inference_rules if (r.s1, r.s2) != (new_rule.s1, new_rule.s2)] + self._inference_rules = rules + self._inference_rules.append(new_rule) else: # it's a target rule! for target in targets: |