From 1f534fbf0c0571feb5d8675e428536436fc58060 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Thu, 25 Mar 2021 18:14:22 -0600 Subject: update the targets requested --- yapymake/__init__.py | 7 +++++++ yapymake/makefile/__init__.py | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/yapymake/__init__.py b/yapymake/__init__.py index 34221f2..fe4b182 100644 --- a/yapymake/__init__.py +++ b/yapymake/__init__.py @@ -12,3 +12,10 @@ def main(): # TODO handle SHELL for input_file in these_args.makefile: file.read(input_file) + + targets = [arg for arg in these_args.targets_or_macros if '=' not in arg] + if len(targets) == 0: + targets = [file.first_non_special_target] + + for target in targets: + file.target(target).update(file) diff --git a/yapymake/makefile/__init__.py b/yapymake/makefile/__init__.py index 1d262e8..7a2adfe 100644 --- a/yapymake/makefile/__init__.py +++ b/yapymake/makefile/__init__.py @@ -20,12 +20,14 @@ class Makefile: _inference_rules: List['InferenceRule'] _macros: Dict[str, Tuple['MacroSource', TokenString]] _targets: Dict[str, 'Target'] + first_non_special_target: Optional[str] args: Args def __init__(self, args: Args): self._inference_rules = [] self._macros = dict() self._targets = dict() + self.first_non_special_target = None self.args = args if args.builtin_rules: @@ -123,6 +125,8 @@ class Makefile: else: # it's a target rule! for target in targets: + if self.first_non_special_target is None: + self.first_non_special_target = target # > A target that has prerequisites, but does not have any commands, can be used to add to the # > prerequisite list for that target. # but also -- cgit v1.2.3