diff options
| author | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2025-08-27 04:16:05 +0300 |
|---|---|---|
| committer | Orfeas <38209077+0xfea5@users.noreply.github.com> | 2025-09-01 04:51:37 +0300 |
| commit | d5c2821d589ef36f885bb4f92a6d6ca0bc4cc0e7 (patch) | |
| tree | 268b9c82a4f26dc009eb852fb5419cc44ab81f01 /aoc.mk | |
| parent | .gitignore: ignore binaries, lsp cache and compile_commands.json (diff) | |
| download | aoc24-d5c2821d589ef36f885bb4f92a6d6ca0bc4cc0e7.tar.gz aoc24-d5c2821d589ef36f885bb4f92a6d6ca0bc4cc0e7.zip | |
Add ‘skel/‘ as template directory for each day
Diffstat (limited to 'aoc.mk')
| -rw-r--r-- | aoc.mk | 32 |
1 files changed, 32 insertions, 0 deletions
| @@ -0,0 +1,32 @@ | |||
| 1 | CXX = g++ | ||
| 2 | CXX_FLAGS = -std=c++23 | ||
| 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} ${CXX_FLAGS} $? -o $@ | ||
| 17 | |||
| 18 | force: | ||
| 19 | |||
| 20 | tests: ${TESTS} | ||
| 21 | |||
| 22 | tests/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 | |||
| 28 | run: compile | ||
| 29 | timeout ${TIMEOUT} ${TARGET} < ${INPUT} | ||
| 30 | |||
| 31 | clean: | ||
| 32 | rm -f ${TARGET} | ||
