Despite being a Linux user for almost 15 years and a HPC nerd for the majority of that time, Makefiles have almost always been a thing that I use, not a thing that I create. In fact, I think the only time I have ever written a Makefile was under duress; a customer wanted one specifically, and even though it added little value I didn’t have a good justification for not adding one.
All Linux users seem to have some skills or techniques which they end up steering around and never quite becoming “fluent” in. The proper usage of tar command flags is a common one; sed
and awk
are other likely candidates. This isn’t too surprising - some features are pretty obscure (when was the last time you saw a named pipe anywhere?), and others simply get buried under layers of abstraction.
Proper usage of make
was (and still is, to some extent) one of those things for me. I understand the premise and can interpret a Makefile without major issues, but the syntax is just too alien to write un-aided.
Some time not too long ago, I discovered just. While this tool isn’t intended as a complete replacement for make
, there is a large overlap, but with a much simpler user experience. For all of those use-cases where I avoided make
because of the friction of writing a good Makefile, just
will fit the bill nicely.
As an example, here is the Justfile for testing and building the static site you are currently reading:
theme:= "PaperMod"
alias t := test
alias b := build
test:
hugo server -D --theme {{theme}} --config config-{{theme}}.toml
build:
hugo --theme {{theme}} --config config-{{theme}}.toml
Nothing could be easier.