summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--aoc.mk35
1 files changed, 35 insertions, 0 deletions
diff --git a/aoc.mk b/aoc.mk
new file mode 100644
index 0000000..c7f8bc0
--- /dev/null
+++ b/aoc.mk
@@ -0,0 +1,35 @@
1CXX = g++-15
2CXXFLAGS = -std=c++26 -O2
3SOLUTION = solution.cpp
4INPUT = input.txt
5TARGET = ./solution
6TESTS = $(wildcard tests/*.input)
7TIMEOUT = 5
8
9.PHONY: run tests force
10
11all: compile run
12
13compile: ${TARGET}
14
15${TARGET}: ${SOLUTION}
16 ${CXX} ${CXXFLAGS} $? -o $@
17
18force:
19
20tests: ${TESTS}
21
22tests/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
31run: compile
32 time timeout ${TIMEOUT} ${TARGET} < ${INPUT}
33
34clean:
35 rm -f ${TARGET}