Last active
March 27, 2020 16:59
-
-
Save distractdiverge/277b25c3ee567b3cae8219ccd153d261 to your computer and use it in GitHub Desktop.
Self-Documenting Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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