Skip to content

Instantly share code, notes, and snippets.

@alexlapinski

alexlapinski/Makefile

Last active Mar 27, 2020
Embed
What would you like to do?
Self-Documenting Makefile
# Colors -- https://www.linuxjournal.com/article/8603
BLACK = "\\033[30m"
RED = "\\033[31m"
GREEN = "\\033[32m"
YELLOW = "\\033[33m"
BLUE = "\\033[34m"
MAGENTA = "\\033[35m"
CYAN = "\\033[36m"
WHITE = "\\033[37m"
END = "\\033[0m"
UNDERLINE = "\\033[4m"
COLWIDTH=8
help: Makefile ## Print this help
@echo ""
@printf "%s ${CYAN}%s${END}\n" "make" "<target>"
@echo ""
@printf "$(UNDERLINE)$(CYAN)%-$(COLWIDTH)s: $(END) $(UNDERLINE)%s$(END)\n" "<target>" "<description>"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort |awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-$(COLWIDTH)s: \033[0m %s\n", $$1, $$2}'
@echo ""
@echo ""
.DEFAULT_GOAL := help
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment