Skip to content

Instantly share code, notes, and snippets.

@Addvilz
Last active July 28, 2021 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Addvilz/50d3d3ee2265ddb9a8bfd404655ca49a to your computer and use it in GitHub Desktop.
Save Addvilz/50d3d3ee2265ddb9a8bfd404655ca49a to your computer and use it in GitHub Desktop.
Makefile help snipped
# Lines prefixed with [hash]- are header lines
# Targets can have tailing [hash]: to document functions
# Target groups can have preceding lines [hash]? name: description to document target groups
help: #: Show this help
@fgrep -h "#-" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/#-\s//'
@printf "\n"
@printf "Common targets:\n"
@fgrep -h "#+" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -Ee "s/([^:]+)(.*)(#\+(.*))/- \1:\4/g"
@printf "\nAvailable target groups:\n"
@fgrep -h "#?" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -Ee "s/^\#\? ([^:]+)\: (.*)/- \1: \2/g" | sort -bfi
@printf "\nAvailable targets:\n"
@fgrep -h "#:" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -Ee "s/([^:]+)(.*)(#:(.*))/- \1:\4/g" | sort -bfi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment