fix: warn user if incompatible shell

This commit is contained in:
Daylin Morgan 2023-01-22 22:34:39 -06:00
parent b4113035af
commit bddd2f3bd2
3 changed files with 20 additions and 7 deletions

View file

@ -27,9 +27,9 @@ tconfirm = $(call py,confirm_py,$(1))
.PHONY: h help _help _print-ansi _update-task.mk .PHONY: h help _help _print-ansi _update-task.mk
TASK_MAKEFILE_LIST := $(filter-out $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)),$(MAKEFILE_LIST)) TASK_MAKEFILE_LIST := $(filter-out $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)),$(MAKEFILE_LIST))
export MAKEFILE_LIST MAKE TASK_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
ifdef PHONIFY ifdef PHONIFY
$(shell $(call py-verbose,phonify_py)) $(shell $(call py-verbose,phonify_py))
endif endif

View file

@ -1,5 +1,13 @@
# ---- [python/bash script runner] ---- # # ---- [python/bash script runner] ---- #
###-- modified from https://unix.stackexchange.com/a/223093 -### ###-- modified from https://unix.stackexchange.com/a/223093 -###
###-
# possible posix process substitions solution:
# https://unix.stackexchange.com/a/639752
# -###
SHELL_CHECK ?= $(shell /bin/sh --version | grep 'bash|zsh|ksh')
ifndef SHELL_CHECK
$(error task.mk requires a process substition compatible shell)
endif
define _newline define _newline

13
task.mk
View file

@ -1,7 +1,7 @@
# }> [github.com/daylinmorgan/task.mk] <{ # # }> [github.com/daylinmorgan/task.mk] <{ #
# Copyright (c) 2022 Daylin Morgan # Copyright (c) 2022 Daylin Morgan
# MIT License # MIT License
TASKMK_VERSION ?= v23.1.1-6-ga980d51-dev TASKMK_VERSION ?= v23.1.1-7-gb411303-dev
# task.mk should be included at the bottom of your Makefile with `-include .task.mk` # task.mk should be included at the bottom of your Makefile with `-include .task.mk`
# See below for the standard configuration options that should be set prior to including this file. # See below for the standard configuration options that should be set prior to including this file.
# You can update your .task.mk with `make _update-task.mk` # You can update your .task.mk with `make _update-task.mk`
@ -389,6 +389,11 @@ def parseargs(argstring):
return parser.parse_args(argstring.split()) return parser.parse_args(argstring.split())
endef endef
# ---- [python/bash script runner] ---- # # ---- [python/bash script runner] ---- #
SHELL_CHECK ?= $(shell /bin/sh --version | grep 'bash|zsh|ksh')
ifndef SHELL_CHECK
$(error task.mk requires a process substition compatible shell)
endif
define _newline define _newline
@ -440,9 +445,9 @@ tconfirm = $(call py,confirm_py,$(1))
.PHONY: h help _help _print-ansi _update-task.mk .PHONY: h help _help _print-ansi _update-task.mk
TASK_MAKEFILE_LIST := $(filter-out $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)),$(MAKEFILE_LIST)) TASK_MAKEFILE_LIST := $(filter-out $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)),$(MAKEFILE_LIST))
export MAKEFILE_LIST MAKE TASK_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
ifdef PHONIFY ifdef PHONIFY
$(shell $(call py-verbose,phonify_py)) $(shell $(call py-verbose,phonify_py))
endif endif