Makefiles are awesome. My only gripe is that build targets are not discoverable
out of the box. That is where self documenting Makefiles shines. Simply append
a description to each make target and the following help
target.
First add the following to the end of your Makefile
help:
@awk -F ':|##' '/^[^\t].+?:.*?##/ {\
printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF \
}' $(MAKEFILE_LIST)
.DEFAULT_GOAL=help
.PHONY=help
Then add comments to targets by appending ## some description
build: ## compile project
commands here
clean: ## remove build artefacts
rm ...
Result is that make
or make help
will output
$ make
build compile
clean remove build artefacts