diff --git a/Makefile b/Makefile index a1e06e1b5..6578a7956 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ CFLAGS += -DGITREV=$(GITREV) ## help commands: help: ## show this help - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf "\033[36m make %-20s\033[0m %s\n", $$1, $$2} /^##(.*)/ {printf "\033[33m%s\n", substr($$0, 4)}' $(MAKEFILE_LIST) + @awk -f help.awk $(MAKEFILE_LIST) ## dependencies commands: @@ -87,7 +87,7 @@ black: cstyle: ## run code style check on low-level C code ./tools/clang-format-check $(shell find embed -type f -name *.[ch]) -## code generation ## +## code generation: templates: ## render Mako templates (for lists of coins, tokens, etc.) ./tools/build_templates diff --git a/help.awk b/help.awk new file mode 100644 index 000000000..e442f9de4 --- /dev/null +++ b/help.awk @@ -0,0 +1,20 @@ +#!/usr/bin/env awk + +BEGIN { + FS = ":.*?## " + first = 1 + COLOR_BROWN = "\033[33m" + COLOR_DARKGREEN = "\033[36m" + COLOR_RESET = "\033[0m" +} /^[a-zA-Z0-9_-]+:.*?## / { + printf COLOR_DARKGREEN + printf " make %-20s", $1 + printf COLOR_RESET + printf " %s\n", $2 +} /^##(.*)/ { + if (!first) + printf "\n" + printf "%s%s\n", COLOR_BROWN, substr($0, 4) + first = 0 +} +