Ramblings of an aging IT geek
← Ramblings of an aging IT geek
tooling

make is the task runner i keep coming back to

A short defence of using a plain Makefile as the project entry point for repos that contain no C whatsoever.

A terminal showing a build running

None of my projects are written in C, and nearly all of them have a Makefile. People find this odd, so here is the case for it.

make is already installed everywhere I care about, it has no runtime, and it gives me one obvious place to put the answer to "how do I do the thing in this repo". New person clones the project, types make, reads the help, and knows how to lint, test and build without reading a wiki. That alone earns its keep.

The trick is to stop thinking of targets as files and start thinking of them as named commands. Mark them .PHONY, give each a short comment, and add a self-documenting help target so make with no arguments prints the menu:

.PHONY: help test lint build

help: ## Show this help
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
	  awk 'BEGIN {FS = ":.*?## "}; {printf "  %-12s %s\n", $$1, $$2}'

test: ## Run the tests
	go test ./...

lint: ## Run the linters
	golangci-lint run

Is it the most powerful task runner out there? No. The moment I need real logic I'm shelling out to a script anyway, and that's fine, the Makefile just calls it. But for the boring 90% it's the lowest-friction front door I've found, and it's the same front door in every repo regardless of language. That consistency is the whole point.