-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (56 loc) · 1.94 KB
/
Makefile
File metadata and controls
75 lines (56 loc) · 1.94 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
default: help
## ==== Template Commands ==============================================================================================
stamp: ## Generate a test project from the template
@uv run copier copy --trust . ..
## ==== Helpers ========================================================================================================
clean: ## Clean up build artifacts and other junk
@rm -rf .venv
@uv run pyclean . --debris
help: ## Show help message
@awk "$$PRINT_HELP_PREAMBLE" $(MAKEFILE_LIST)
# ..... Make configuration .............................................................................................
.ONESHELL:
SHELL:=/bin/bash
.PHONY: stamp clean help
# ..... Color table for pretty printing ................................................................................
RED := \033[31m
GREEN := \033[32m
YELLOW := \033[33m
BLUE := \033[34m
TEAL := \033[36m
GRAY := \033[90m
CLEAR := \033[0m
ITALIC := \033[3m
# ..... Hidden auxiliary targets .......................................................................................
_confirm: # Requires confirmation before proceeding (Do not use directly)
@if [[ -z "$(CONFIRM)" ]]; then \
echo -n "Are you sure? [y/N] " && read ans && [ $${ans:-N} = y ]; \
fi
# ..... Help printer ...................................................................................................
define PRINT_HELP_PREAMBLE
BEGIN {
print "Usage: $(YELLOW)make <target>$(CLEAR)"
print
print "Targets:"
}
/^## =+ .+( =+)?/ {
s = $$0
sub(/^## =+ /, "", s)
sub(/ =+/, "", s)
printf("\n %s:\n", s)
}
/^## -+ .+( -+)?/ {
s = $$0
sub(/^## -+ /, "", s)
sub(/ -+/, "", s)
printf("\n $(TEAL)> %s$(CLEAR)\n", s)
}
/^[$$()% 0-9a-zA-Z_\/-]+(\\:[$$()% 0-9a-zA-Z_\/-]+)*:.*?##/ {
t = $$0
sub(/:.*/, "", t)
h = $$0
sub(/.?*##/, "", h)
printf(" $(YELLOW)%-19s$(CLEAR) $(GRAY)$(ITALIC)%s$(CLEAR)\n", t, h)
}
endef
export PRINT_HELP_PREAMBLE