diff options
| author | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2025-12-03 13:24:11 +0200 |
|---|---|---|
| committer | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2025-12-03 13:40:22 +0200 |
| commit | e1503df1a649dbae6e5856d8400b7d22f5891389 (patch) | |
| tree | 938bda152755fc976fd3cbe1096a6a30de921c87 /aoc.mk | |
| parent | add day initialization script (diff) | |
| download | aoc25-e1503df1a649dbae6e5856d8400b7d22f5891389.tar.gz aoc25-e1503df1a649dbae6e5856d8400b7d22f5891389.zip | |
add aoc.mk
Diffstat (limited to 'aoc.mk')
| -rw-r--r-- | aoc.mk | 35 |
1 files changed, 35 insertions, 0 deletions
| @@ -0,0 +1,35 @@ | |||
| 1 | CXX = g++-15 | ||
| 2 | CXXFLAGS = -std=c++26 -O2 | ||
| 3 | SOLUTION = solution.cpp | ||
| 4 | INPUT = input.txt | ||
| 5 | TARGET = ./solution | ||
| 6 | TESTS = $(wildcard tests/*.input) | ||
| 7 | TIMEOUT = 5 | ||
| 8 | |||
| 9 | .PHONY: run tests force | ||
| 10 | |||
| 11 | all: compile run | ||
| 12 | |||
| 13 | compile: ${TARGET} | ||
| 14 | |||
| 15 | ${TARGET}: ${SOLUTION} | ||
| 16 | ${CXX} ${CXXFLAGS} $? -o $@ | ||
| 17 | |||
| 18 | force: | ||
| 19 | |||
| 20 | tests: ${TESTS} | ||
| 21 | |||
| 22 | tests/test%.input: tests/test%.output compile force | ||
| 23 | @diff -BZ --color=always \ | ||
| 24 | <(timeout ${TIMEOUT} ${TARGET} < $@) \ | ||
| 25 | <(cat $<) \ | ||
| 26 | > /tmp/aoc.output \ | ||
| 27 | && echo -e "$@ [\e[0;32mok\e[m]" \ | ||
| 28 | || echo -e "$@ [\e[0;31mfail\e[m]" | ||
| 29 | @cat /tmp/aoc.output | ||
| 30 | |||
| 31 | run: compile | ||
| 32 | time timeout ${TIMEOUT} ${TARGET} < ${INPUT} | ||
| 33 | |||
| 34 | clean: | ||
| 35 | rm -f ${TARGET} | ||
