9 ms·
Make is a file-based dependency tree that only defaults to a specific shell. If you really want to go crazy, you could actually change it to anything that can
by Izkata 5y ago
Make is a file-based dependency tree that only defaults to a specific shell. If you really want to go crazy, you could actually change it to anything that can be invoked with "<executable> <file>", such as python, and use that language instead.
As a really crude example:
SHELL := python
.ONESHELL:
out.csv:
import csv
with open("$@", "w") as f:
writer = csv.writer(f)
writer.writerow(["header1", "header2"])
and so:
$ make
import csv
with open("out.csv", "w") as f:
writer = csv.writer(f)
writer.writerow(["header1", "header2"])
$ cat out.csv
header1,header2
I get that this doesn't exactly solve your "cross-platform work" gripe, but my point is that a lot of what people perceive as make providing isn't actually make in the first place.
- pqb 5y agoThank you for reminding me it! Awesome finding. Worth noting, each recipe can have its very own SHELL[0] (e.g., ruby recipe, that uses ruby command with -e flag): ruby: .SHELLFLAGS := -e ruby: SHELL := ruby ruby: greeting = "labas" puts "#{greeting}, ruby!" [0]: http://agdr.org/2020/05/14/Polyglot-Makefiles.html http://agdr.org/2020/05/14/Polyglot-Makefiles.html
- Izkata 5y agoNice, being able to mix them is new to me. I thought SHELL could only be set once.