diff --git a/src/builtins.mk b/src/builtins.mk index da77fb8..af69fba 100644 --- a/src/builtins.mk +++ b/src/builtins.mk @@ -25,8 +25,7 @@ tprint = $(call py,print_py,$(1)) tprint-verbose= $(call py-verbose,print_py,$(1)) tconfirm = $(call py,confirm_py,$(1)) .PHONY: h help _help _print-ansi _update-task.mk -TASK_MAKEFILE_LIST := $(filter-out .task.cfg.mk .task.mk,$(MAKEFILE_LIST)) -export MAKEFILE_LIST MAKE TASK_MAKEFILE_LIST +export MAKEFILE_LIST MAKE ifdef PHONIFY $(shell MAKEFILE_LIST='$(MAKEFILE_LIST)' $(call py-verbose,phonify_py)) endif diff --git a/src/help.py b/src/help.py index afa7f7f..7d27b13 100644 --- a/src/help.py +++ b/src/help.py @@ -2,6 +2,7 @@ #% block name %#help#% endblock %# #% block script %# from collections import namedtuple +from pathlib import Path import subprocess from textwrap import wrap @@ -39,11 +40,15 @@ def recipe_help_header(goal): else: return f" {ansi.style(goal,'goal')}" +def get_makefile_list(): + pattern = re.compile(r'^\.?task.*?\.mk$$') ###- make needs a double dollar -### + makefiles = os.getenv("MAKEFILE_LIST", "").split() + return (f for f in makefiles if not pattern.match(Path(f).name)) def get_goal_deps(goal="task.mk"): make = os.getenv("MAKE", "make") cmd = [make, "-p", "-n", "-i"] - for file in os.getenv("TASK_MAKEFILE_LIST", "").split(): + for file in get_makefile_list(): cmd.extend(["-f", file]) database = subprocess.check_output(cmd, universal_newlines=True) dep_pattern = re.compile(r"^" + goal + ":(.*)?")