task.mk/src/builtins.mk

36 lines
1.2 KiB
Makefile
Raw Normal View History

2022-09-20 11:08:47 -05:00
# ---- [builtin recipes] ---- #
ifeq (help,$(firstword $(MAKECMDGOALS)))
HELP_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
export HELP_ARGS
endif
2022-09-05 12:23:17 -05:00
## h, help | show this help
h help:
$(call py,help_py) || { echo "exiting early!"; exit 1; }
2022-09-05 12:23:17 -05:00
_help: export SHOW_HIDDEN=true
_help: help
ifdef PRINT_VARS
$(foreach v,$(PRINT_VARS),$(eval export $(v)))
.PHONY: vars v
vars v:
$(call py,vars_py,$(PRINT_VARS))
endif
### | args: -ws --hidden
### task.mk builtins: | args: -d --hidden
2022-09-05 17:44:39 -05:00
## _print-ansi | show all possible ansi color code combinations
_print-ansi:
$(call py,print_ansi_py)
2022-09-05 12:23:17 -05:00
# functions to take f-string literals and pass to python print
2022-10-03 16:02:30 -05:00
tprint = $(call py,print_py,$(1))
tprint-sh = $(call pysh,print_py,$(1))
2022-09-14 16:52:49 -05:00
tconfirm = $(call py,confirm_py,$(1))
## _update-task.mk | downloads latest development version of task.mk
2022-09-05 12:23:17 -05:00
_update-task.mk:
$(call tprint,{a.b_cyan}Updating task.mk{a.end})
2022-09-05 12:23:17 -05:00
curl https://raw.githubusercontent.com/daylinmorgan/task.mk/main/task.mk -o .task.mk
2022-09-25 17:43:12 -05:00
.PHONY: h help _help _print-ansi _update-task.mk
TASK_MAKEFILE_LIST := $(filter-out $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)),$(MAKEFILE_LIST))
export MAKEFILE_LIST MAKE TASK_MAKEFILE_LIST
2022-09-21 16:20:51 -05:00
ifndef INHERIT_SHELL
SHELL := $(shell which bash)
2022-09-21 16:20:51 -05:00
endif