# A Makefile help target

tags: makefile

The longer I’m around in this industry, the more I rely on Makefiles to remember all the steps I need to take. If something else doesn’t put the steps in order, I’m not likely to remember everything myself. This website even has a /Makefile (it is all in a public GitHub repo, so have at it), and it has a feature that I’ve come to love.

François Zaninotto wrote about Self-documented Makefile. He didn’t really document the Makefile so much as give it a target summary like you’d get from rake:

Usually I know I have a target for something but I forget the name. Although I usually have the Makefile open, I have an easier time with make help. That is, when I remember to use it.

It’s an easy task. Grep the Makefile for targets (which is very easy because the targets start at the first column) and check if there’s a ## comment after it. Sort what you find and format it.