makehelp is a small tool for software developers. It brings a small doxygen-style help system into Makefiles. This way it removes the burden and extra-work to maintain extra-documentation on how to use Makefiles. Instead, the help text can be embedded in special comments within the Makefile. This way, makehelp works for Makefiles just like javadoc works for Java or ↗Doxygen works for a lot of programming languages. And keeping the documentation uptodate becomes very trivial.
The current version of makehelp is just a tiny perl script which you can ↗download from GitHub.
The following Makefile shows a minimal Makefile for a tiny C project.
override CFLAGS+=-std=c99 .PHONY: all all: hello .PHONY: clean clean: rm -rf hello hello.o
A few simple changes add support for makehelp:
override CFLAGS+=-std=c99 .PHONY: all ## Builds everything. all: hello .PHONY: clean ## Removes generated files. clean: rm -rf hello hello.o .PHONY: help ## Prints this help text. help: perl makehelp.pl $(MAKEFILE_LIST)
Now the user can invoke make help and will see the following nice usage message for the Makefile:
Usage: make [OPTION|GOAL|VARIABLE]... Runs make to make the specified GOALs. If no GOAL is specified, the default goal is made (usually "all"). Popular make OPTIONs: -s Silent mode, disables command echo. -k Keep going, continues after errors. -j N Run N jobs in parallel. -n Don't run the commands, just print them. -q Run no commands; exit status says if up to date. -h Print make help text. Use option -h to lits the GNUmake part of the help. Supported GOALs: all Builds everything. clean Removes generated files. help Prints this help text.
include (via MAKEFILE_LIST variable).makehelp requires Perl 5.8 or newer. GNUmake; other make tools might work, too, but makehelp was only designed for GNUmake.