Thanks to the article “Your Makefiles are wrong” it really dawned on me that Makefile can run any interpreter, not just sh or bash:
The key message here, of course, is to choose a specific shell. If you’d rather use ZSH, or Python or Node for that matter, set it to that.
Now, there are lots of articles and discussions purporting to discuss a “Python Makefile” (for example, 1, 2). But what they actually discuss is how to invoke Python interpreter in Makefile. But that’s not what Jacob (the first article’s author) meant. You can really put Python code into Makefile:
SHELL := python
.ONESHELL: # for multiline scripts to work as one
default:
what = 'world'
print(f'hello {what}')
Output:
$ make
what = 'world'
print(f'hello {what}')
hello world
Have fun with that.