I like Makefiles: The syntax is quite simple, it's easy to use and it's useful to group commands in one place. In 2016, Marmelab published an article on documenting a Makefile. With some shell script voodoo, you can run make help and it will print all the available targets and their descriptions. It works and it is simple. I've been using this trick for years and I'm happy with it.
Today I would like to go one step further: Let's improve the help target so it also outputs the variables and their values. To do so, we can read the internal database thanks to make -p. This command prints a lot of information: recipes, prerequisites, environment variables, variables and so on.
A quick lookup to the output later, I can extract the relevant information with the command, nothing fancy here:
Finally, let's format and print the result. Makefile looks like this: