1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 02:58:57 +00:00

make help: typo fix, add spacing & refactor (#413)

* help: fix 'code generation' label
* help: add a newline after each command group
* Makefile: move awk command to a separate script for readability
This commit is contained in:
Vladyslav Burzakovskyy 2019-01-15 18:04:50 +01:00 committed by Pavol Rusnak
parent 2d70d5d447
commit 6a70c9ba52
2 changed files with 22 additions and 2 deletions

View File

@ -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

20
help.awk Normal file
View File

@ -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
}