def execute(self, makefile, context): atargets = data.stripdotslashes(self.targetexp.resolvesplit(makefile, makefile.variables)) targets = [data.Pattern(p) for p in _expandwildcards(makefile, atargets)] if not len(targets): context.currule = DummyRule() return ispatterns = set((t.ispattern() for t in targets)) if len(ispatterns) == 2: raise data.DataError("Mixed implicit and normal rule", self.targetexp.loc) ispattern, = ispatterns if ispattern and context.weak: raise data.DataError("Pattern rules not allowed in includedeps", self.targetexp.loc) deps = [p for p in _expandwildcards(makefile, data.stripdotslashes(self.depexp.resolvesplit(makefile, makefile.variables)))] if ispattern: rule = data.PatternRule(targets, map(data.Pattern, deps), self.doublecolon, loc=self.targetexp.loc) makefile.appendimplicitrule(rule) else: rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=context.weak) for t in targets: makefile.gettarget(t.gettarget()).addrule(rule) makefile.foundtarget(targets[0].gettarget()) context.currule = rule
def _executeweak(self, makefile, context): """ If the context is weak (we're just handling dependencies) we can make a number of assumptions here. This lets us go really fast and is generally good. """ assert context.weak assert len(self.targetexp.resolvesplit(makefile, makefile.variables)) == 1 target = self.targetexp.resolvesplit(makefile, makefile.variables)[0] deps = self.depexp.resolvesplit(makefile, makefile.variables) rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=True) makefile.gettarget(target).addrule(rule) makefile.foundtarget(target) context.currule = rule
def _execute(self, makefile, context): assert not context.weak atargets = data.stripdotslashes( self.targetexp.resolvesplit(makefile, makefile.variables)) targets = [ data.Pattern(p) for p in _expandwildcards(makefile, atargets) ] if not len(targets): context.currule = DummyRule() return ispatterns = set((t.ispattern() for t in targets)) if len(ispatterns) == 2: raise errors.DataError("Mixed implicit and normal rule", self.targetexp.loc) ispattern, = ispatterns deps = list( _expandwildcards( makefile, data.stripdotslashes( self.depexp.resolvesplit(makefile, makefile.variables)))) if ispattern: prerequisites = [data.Pattern(d) for d in deps] rule = data.PatternRule(targets, prerequisites, self.doublecolon, loc=self.targetexp.loc) makefile.appendimplicitrule(rule) else: rule = data.Rule(deps, self.doublecolon, loc=self.targetexp.loc, weakdeps=False) for t in targets: makefile.gettarget(t.gettarget()).addrule(rule) makefile.foundtarget(targets[0].gettarget()) context.currule = rule
def _executeweak(self, makefile, context): """ If the context is weak (we're just handling dependencies) we can make a number of assumptions here. This lets us go really fast and is generally good. """ assert context.weak deps = self.depexp.resolvesplit(makefile, makefile.variables) # Skip targets with no rules and no dependencies if not deps: return targets = data.stripdotslashes( self.targetexp.resolvesplit(makefile, makefile.variables)) rule = data.Rule(list(data.stripdotslashes(deps)), self.doublecolon, loc=self.targetexp.loc, weakdeps=True) for target in targets: makefile.gettarget(target).addrule(rule) makefile.foundtarget(target) context.currule = rule