aoc-2020-zig

Advent of Code 2020 Solutions in Zig
git clone https://git.sinitax.com/sinitax/aoc-2020-zig
Log | Files | Refs | README | sfeed.txt

Makefile (546B)


      1DAYS = $(shell seq 1 25 | xargs printf "%02i\n")
      2
      3.PHONY: all
      4all::
      5
      6define make-day
      7all:: $1/run
      8.PHONY: $1/run
      9$1/main: $1/main.zig
     10	zig build-exe \
     11		--pkg-begin "aoc" "common/aoc.zig" --pkg-end \
     12		--pkg-begin "console8" "common/console8.zig" --pkg-end \
     13		--cache-dir .cache/zig -femit-bin=$1/main -freference-trace \
     14		$1/main.zig
     15$1/run: $1/main
     16	@echo "== day $1 =="
     17	@echo -en "\npart 1: " && cd $1 && time ./main 1
     18	@echo -en "\npart 2: " && cd $1 && time ./main 2
     19	@echo ""
     20endef
     21$(foreach day,$(DAYS),$(eval $(call make-day,$(day))))