The article calls out GNU Make, so almost everything else in there is also non-portable.
The article calls out GNU Make, so almost everything else in there is also non-portable.
I definitely don't remember the last machine I saw that didn't have bash on it.
If you're working in a team with other people, or are publishing things for a broader public to use… no. Especially since things like .ONESHELL don't just flat-out cause errors, but rather introduce subtle and insidious distinctions in behavior.
And a Make supergenius, should I ever meet one, surely will look at the top of the file or derive from "incorrect" code that something is nonstandard.
I'd love better tools that take the good parts of Make (around file transformations, mostly) and expose them more effectively in shells (because doing so in a more fully featured programming language often results in different and worse hacks--hi, Rake) but using Make to do things more people will find predictable seems fine to me.
Example:
.ONESHELL:
sometarget: someinput
␉BASEDIR=other_expression
␉SHELLVAR=complicated_expression
␉rm -rf $$BASEDIR/$$SHELLVAR
(obviously extreme to illustrate the point, but you get the idea.)(If you use any of these features — please rename your Makefile to GNUmakefile. Please. I beg you.)
I can only assume that's the last of the GPLv2 licensed ones. Classic Apple.
My brain honestly didn't process that, and it's still refusing to. I think it's the braces around (GNU) — seems like I have some neurons wired to push (bracketed) pieces of text down into a "detail" stack and eliminate them from high-level processing…
P.S./ed.: GNU make looks for GNUmakefile before Makefile, and arguably if the Makefile is GNU specific, that feature should be used — and that includes the title of the article ("Your GNUmakefiles Are Wrong")