aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile')
-rw-r--r--src/Makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..fa2190c
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,21 @@
+DAYS = $(shell seq 1 25 | xargs printf "%02i\n")
+
+.PHONY: all
+all::
+
+define make-day
+all:: $1/run
+.PHONY: $1/run
+$1/main: $1/main.zig
+ zig build-exe \
+ --pkg-begin "aoc" "common/aoc.zig" --pkg-end \
+ --pkg-begin "console8" "common/console8.zig" --pkg-end \
+ --cache-dir .cache/zig -femit-bin=$1/main -freference-trace \
+ $1/main.zig
+$1/run: $1/main
+ @echo "== day $1 =="
+ @echo -en "\npart 1: " && cd $1 && time ./main 1
+ @echo -en "\npart 2: " && cd $1 && time ./main 2
+ @echo ""
+endef
+$(foreach day,$(DAYS),$(eval $(call make-day,$(day))))