-
Notifications
You must be signed in to change notification settings - Fork 26
/
help.mk
43 lines (42 loc) · 2.21 KB
/
help.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
.PHONY: help
help: ## Shows this generated help info for Makefile targets
@grep -E '^[a-zA-Z0-9_-]+:' $(MAKEFILE_LIST) | \
awk -F: ' \
{ \
target=$$2; \
if ( !(target in targets) ) { \
if ( /:.*##/ ) { \
if ( ! /no-help/ ) { \
sub(/^.*## ?/,"",$$0); \
targets[target] = $$0; \
} \
} else { \
targets[target] = "" \
} \
} \
} \
END { \
for (target in targets) { \
printf "\033[36m%-30s\033[0m %s\n", target, targets[target] \
} \
}' | sort
.targets:
@grep -E '^[a-zA-Z0-9_-]+:' $(MAKEFILE_LIST) | \
awk -F: ' \
{ \
target=$$2; \
if ( !(target in targets) ) { \
if ( /:.*##/ ) { \
if ( ! /no-help/ ) { \
targets[target] = ""; \
} \
} else { \
targets[target] = "" \
} \
} \
} \
END { \
for (target in targets) { \
printf "%s ", target, targets[target] \
} \
}'