-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (23 loc) · 887 Bytes
/
Makefile
File metadata and controls
29 lines (23 loc) · 887 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
DAYS := 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
TODAY := $(shell TZ=America/New_York date +%y%m%d)
# if we're in the AOC month, set default goal to today's problem
.DEFAULT_GOAL := $(or $(filter $(TODAY:2312%=%),$(DAYS)),help)
.PHONY: $(DAYS) all help
inputs/%.in:
./fetch.sh $*
src/bin/%.rs:
DAY=$* envsubst < src/template.rs > $@
$(DAYS): %: src/bin/%.rs inputs/%.in
cargo run --quiet --release --bin $*
all: $(patsubst src/bin/%.rs,inputs/%.in,$(wildcard src/bin/*.rs))
cargo run --quiet --release
help:
@echo 'usage: make [TARGET..]'
@echo 'Automatically downloads input, sets up files, and runs solutions.'
@echo
@echo 'TARGET:'
@echo ' {01..25} run a specific day, e.g 01'
@echo ' all run all days'
@echo ' help show this help text'
@echo
@echo "During the AoC month 'make' will run the current day's solution"