-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (23 loc) · 700 Bytes
/
Makefile
File metadata and controls
29 lines (23 loc) · 700 Bytes
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
test:
@echo \# testing day??/solve.py
flake8 day??/solve.py
for script in day??/solve.py; do python3 -m doctest "$$script"; done
.PHONY: test
day = $(shell day="$*"; echo $${day#0})
day%: day%/input.txt day%/solve.py
touch "$@"
.PRECIOUS: day%/input.txt day%/solve.py
day%/solve.py:
mkdir --parents "$(@D)"
sed "s/{{day}}/$(day)/" <stub.py >"$@"
chmod +x "$@"
day%/input.txt: session.txt
mkdir --parents "$(@D)"
curl --cookie "session.txt" --output "$@" \
"https://adventofcode.com/2022/day/$(day)/input"
day%/output1.txt: day%/input.txt day%/solve.py
cd "$(@D)"; python3 solve.py 1
cat "$@"
day%/output2.txt: day%/input.txt day%/solve.py
cd "$(@D)"; python3 solve.py 2
cat "$@"