mirror of
https://github.com/daylinmorgan/task.mk.git
synced 2024-11-09 19:13:14 -06:00
fix: collect correct file when invoked with -f
This commit is contained in:
parent
b75a3c2c98
commit
3defee72dc
2 changed files with 7 additions and 2 deletions
|
@ -29,7 +29,8 @@ tconfirm = $(call py,confirm_py,$(1))
|
||||||
_update-task.mk:
|
_update-task.mk:
|
||||||
$(call tprint,{a.b_cyan}Updating task.mk{a.end})
|
$(call tprint,{a.b_cyan}Updating task.mk{a.end})
|
||||||
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
|
||||||
export MAKEFILE_LIST MAKE
|
TASK_MAKEFILE_LIST := $(filter-out $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
||||||
|
export MAKEFILE_LIST MAKE TASK_MAKEFILE_LIST
|
||||||
ifndef INHERIT_SHELL
|
ifndef INHERIT_SHELL
|
||||||
SHELL := $(shell which bash)
|
SHELL := $(shell which bash)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -82,7 +82,10 @@ def recipe_help_header(goal):
|
||||||
|
|
||||||
def get_goal_deps(goal="task.mk"):
|
def get_goal_deps(goal="task.mk"):
|
||||||
make = os.getenv("MAKE", "make")
|
make = os.getenv("MAKE", "make")
|
||||||
database = subprocess.check_output([make, "-p", "-n"], universal_newlines=True)
|
cmd = [make, "-p", "-n", "-i"]
|
||||||
|
for file in os.getenv("TASK_MAKEFILE_LIST", "").split():
|
||||||
|
cmd.extend(["-f", file])
|
||||||
|
database = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
dep_pattern = re.compile(r"^" + goal + ":(.*)?")
|
dep_pattern = re.compile(r"^" + goal + ":(.*)?")
|
||||||
for line in database.splitlines():
|
for line in database.splitlines():
|
||||||
match = dep_pattern.search(line)
|
match = dep_pattern.search(line)
|
||||||
|
@ -196,4 +199,5 @@ def main():
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
||||||
#% endblock %#
|
#% endblock %#
|
||||||
|
|
Loading…
Reference in a new issue