-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
86 lines (75 loc) · 3.22 KB
/
makefile
File metadata and controls
86 lines (75 loc) · 3.22 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
76
77
78
79
80
81
82
83
84
85
86
.DEFAULT_GOAL := help
mage := go run mage.go
## run the test cases
.PHONY: test
test:
@go test "./lib/..."
## run the solution for the specified SITE/YEAR/DAY/PART
.PHONY: run
run:
@$(mage) run
## run the solution for the specified SITE/YEAR/DAY/PART whenever a file changes
.PHONY: watch
watch:
@$(mage) watch
## verify the solution output for the specified SITE/YEAR/DAY/PART
.PHONY: verify
verify:
@$(mage) verify
## run the solution for the specified SITE/YEAR/DAY/PART whenever a file changes
.PHONY: next
next:
@$(mage) next
## wait until the start time for puzzles to be released for the specified SITE
.PHONY: wait-until-start-time
wait-until-start-time:
@$(mage) WaitUntilStartTime
## run all solutions for the specified SITE/YEAR
.PHONY: run-year
run-year:
@$(mage) ListYear | \
while read year day part; do \
printf "YEAR=%d DAY=%02d PART=%d " $${year} $${day} $${part}; \
YEAR=$${year} DAY=$${day} PART=$${part} $(mage) run; \
done
## verify the solution output of the specified SITE/YEAR/DAY
.PHONY: verify-day
verify-day:
@$(mage) ListDay | \
while read year day part; do \
YEAR=$${year} DAY=$${day} PART=$${part} $(mage) verify; \
done
## verify the solution output of the specified SITE/YEAR
.PHONY: verify-year
verify-year:
@$(mage) ListYear | \
while read year day part; do \
YEAR=$${year} DAY=$${day} PART=$${part} $(mage) verify; \
done
## display this help message
.PHONY: help
help:
@awk ' \
BEGIN { \
printf "Usage:\n" \
} \
\
/^##@/ { \
printf "\n\033[1m%s:\033[0m\n", substr($$0, 5) \
} \
\
/^##([^@]|$$)/ && $$2 != "" { \
$$1 = ""; \
if (message == null) { \
message = $$0; \
} else { \
message = message "\n " $$0; \
} \
} \
\
/^[a-zA-Z_-]+:/ && message != null { \
target = substr($$1, 0, length($$1)-1); \
printf " \033[36m%-11s\033[0m %s\n", target, message; \
message = null; \
} \
' $(MAKEFILE_LIST)