DEV Community

Cover image for Makefiles — add a make help command
Anton Dolganin
Anton Dolganin

Posted on

Makefiles — add a make help command

If you’re using Makefiles — add a make help command.
It auto-parses comments and shows all tasks instantly.

Simple hack, huge productivity boost.

help:
    @awk 'BEGIN {FS=":"} \
    /^#/ {comment=substr($$0,3)} \
    /^[a-zA-Z0-9_-]+:/ {printf "\033[36m%-20s\033[0m %s\n", $$1, comment}' Makefile
Enter fullscreen mode Exit fullscreen mode

Top comments (0)