Add help info to Make

Jan 4, 2018

There is a magic code:

help:  ## Show this help.
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

Add the code to your Makefile like this:

help:  ## Show this help.
	@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'

hello:  ## Echo hello
	@echo hello

world:  ## Echo world
	@echo world

Then just play!

$ make help
help:    Show this help.
hello:    Echo hello
world:    Echo world

Your targets could be self-documenting for now.

See also this.