Skip to content

Instantly share code, notes, and snippets.

@Xisabla
Created September 8, 2018 17:40
Show Gist options
  • Save Xisabla/5cb2663e8eb1b935bdde683699e195ff to your computer and use it in GitHub Desktop.
Save Xisabla/5cb2663e8eb1b935bdde683699e195ff to your computer and use it in GitHub Desktop.
Makefile help parsing
help: ## Show this help.
@printf "\033[32m%-30s \033[32m %s\n" "VARIABLE NAME" "DEFAULT_VALUE"
@grep -E '^[a-zA-Z_-]+(\?=|=).*$$' $(MAKEFILE_LIST) |sort | awk 'BEGIN {FS = "(?=|=)"}; {printf "\033[36m%-30s \033[0m %s\n", $$1, $$2}'
@printf "\n\033[32m%-30s \033[32m %s\033[0m\n" "RECIPE" "DESCRIPTION"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "make \033[36m%-30s\033[0m %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment