makefile to just
converting this site's Makefile to `just` | back
i recently discovered the lovely little just
command runner. it's lovely. for an explanation of why it's lovely, see its readme.
as for why i love it: it replaces make
.
make is a very poweful, useful tool. it is also incredibly messy and i by definition use it wrong, since most of my usage of make
is as less a build tool and more a general-purpose command runner, which is something it is not designed to do. it works, but lacks a lot of quality of life features which just
provides, such as the ability to list recipes from the command line.
converting this site
this was the old Makefile:
: : : :
:
it has some issues, including the fact that it was written before i knew what phonies were.
this is the new justfile:
# Build the site.
: # Compress the built site into a tarball for uploading.
: # Publish the site to `alterae.srht.site`.
: # Remove all build artifacts.
:
# Build the site in watch mode and serve it at `hostname:1111.
:
admittedly the difference is mostly in the names of the recipes, but that alone is an improvement. one of the big features just doesn't have is conditional running based on whether or not files have changed. honestly, that's not something i miss or need much, and here is not really an exception. additionally, without it, we don't need .PHONY
targets everywhere.
what we lose in file-update checking, we gain in ease-of-use. running just --list
displays all the available recipes, using the comments as documentation.
the transition was really easy, though i should really move the token into a .env file in the project directory at some point.
TL;DR
this site had a Makefile. now it has a justfile instead.