Makefile (853B)
1DAYS = $(shell seq 1 25 | xargs printf "%02i\n") 2 3all:: build run 4 5define make-day 6 7run:: $1/run 8 9build:: $1/main 10 11clean:: $1/clean 12 13.PHONY: $1/run $1/clean 14 15$1/target/debug/day$1: $1/src/main.rs 16 @cd $1 && cargo build 17 18$1/target/release/day$1: $1/src/main.rs 19 @cd $1 && cargo build -r 20 21$1/main: $1/target/release/day$1 22 @cp $1/target/release/day$1 $1/main 23 24$1/debug1: $1/target/debug/day$1 25 @cd $1 && time ./target/debug/day$1 1 26 27$1/debug2: $1/target/debug/day$1 28 @cd $1 && time ./target/debug/day$1 2 29 30$1/run1: $1/main 31 @cd $1 && time ./main 1 32 33$1/run2: $1/main 34 @cd $1 && time ./main 2 35 36$1/run: $1/main 37 @echo "== day $1 ==" 38 @echo -en "\npart 1: " && cd $1 && time ./main 1 39 @echo -en "\npart 2: " && cd $1 && time ./main 2 40 @echo "" 41 42$1/clean: 43 rm $1/main 44 45endef 46 47$(foreach day,$(DAYS),$(eval $(call make-day,$(day)))) 48 49.PHONY: all build run clean