Over the last several years I’ve found myself needing to explain/justify my habit of using a
Makefile in software projects. I figure it’s time to create a post about it, so I can just refer here in the future.
I’ve a long-standing (decade+) habit of (ab)using Makefiles in projects, regardless of what the language(s) are and what other kinds of management tools are in use. Here’s one example. I don’t actually use them to compile things, or for keeping track of when files change, but more as a convenient mnemonic standard.
My rationale has been:
makeis ubiquitous so there’s usually nothing to install
- heterogenous projects involve multiple languages, with multiple invocation syntaxes.
makeallows me to easily remember a short command that is meaningful for what I want to accomplish (execute a task, start or stop a service, etc), rather than needing to first think “what language is this?”
makeis language agnostic. It’s just a handy way to group shell invocations together with environment variables and comments/context.
make foobaris easier to remember (for me) than
foobar with --all the --usual but sometimes --forgettable options.
- during the workday, switching between repos that have different languages/tools/frameworks can create cognitive overhead, and
make runwill just work regardless of what directory I’m in
- it’s both a way of documenting common tasks for shared developer knowledge/utility, and making it more convenient to onboard developers, regardless of whatever other tools that they might be familiar with.
- a Makefile is like an executable README