summaryrefslogtreecommitdiffstats
path: root/aoc.mk
diff options
context:
space:
mode:
Diffstat (limited to 'aoc.mk')
-rw-r--r--aoc.mk32
1 files changed, 32 insertions, 0 deletions
diff --git a/aoc.mk b/aoc.mk
new file mode 100644
index 0000000..c7b7c87
--- /dev/null
+++ b/aoc.mk
@@ -0,0 +1,32 @@
1CXX = g++
2CXX_FLAGS = -std=c++23
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} ${CXX_FLAGS} $? -o $@
17
18force:
19
20tests: ${TESTS}
21
22tests/test%.input: tests/test%.output compile force
23 @diff <(timeout ${TIMEOUT} ${TARGET} < $@) <(cat $<) > /tmp/aoc.output \
24 && echo -e "$@ [\e[0;32mok\e[m]" \
25 || echo -e "$@ [\e[0;31mfail\e[m]"
26 @cat /tmp/aoc.output
27
28run: compile
29 timeout ${TIMEOUT} ${TARGET} < ${INPUT}
30
31clean:
32 rm -f ${TARGET}