From e1503df1a649dbae6e5856d8400b7d22f5891389 Mon Sep 17 00:00:00 2001 From: Orfeas <38209077+0xfea5@users.noreply.github.com> Date: Wed, 3 Dec 2025 13:24:11 +0200 Subject: add aoc.mk --- aoc.mk | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 aoc.mk (limited to 'aoc.mk') diff --git a/aoc.mk b/aoc.mk new file mode 100644 index 0000000..c7f8bc0 --- /dev/null +++ b/aoc.mk @@ -0,0 +1,35 @@ +CXX = g++-15 +CXXFLAGS = -std=c++26 -O2 +SOLUTION = solution.cpp +INPUT = input.txt +TARGET = ./solution +TESTS = $(wildcard tests/*.input) +TIMEOUT = 5 + +.PHONY: run tests force + +all: compile run + +compile: ${TARGET} + +${TARGET}: ${SOLUTION} + ${CXX} ${CXXFLAGS} $? -o $@ + +force: + +tests: ${TESTS} + +tests/test%.input: tests/test%.output compile force + @diff -BZ --color=always \ + <(timeout ${TIMEOUT} ${TARGET} < $@) \ + <(cat $<) \ + > /tmp/aoc.output \ + && echo -e "$@ [\e[0;32mok\e[m]" \ + || echo -e "$@ [\e[0;31mfail\e[m]" + @cat /tmp/aoc.output + +run: compile + time timeout ${TIMEOUT} ${TARGET} < ${INPUT} + +clean: + rm -f ${TARGET} -- cgit v1.2.3