summaryrefslogtreecommitdiff
path: root/test/GNUmakefile
blob: 10e3b343e68b12678847bb8e61f74b6ec6a0b6e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

TESTS = $(basename $(shell find . -type f -name '*.cpp'))
CXX = g++ -std=gnu++20 -I ../content/ -O2 -Wall -Wextra -Wshadow -Werror

test: $(TESTS:=.ok)

missing:
	@find ../content -name '*.cpp' | sed 's|^../content/||' \
	  | while read -r f ; do [ -e "$$f" ] || echo "$$f" ; done \
	  | sort > missing.tmp
	@sort missing.ignore | comm -23 missing.tmp -
	@rm missing.tmp

clean:
	rm -f $(TESTS:=.test) $(TESTS:=.ok) $(TESTS:=.d)

%.ok: %.test
	timeout --foreground --verbose 60 prlimit -s$$((1<<32)) ./$<
	@touch $@

%.test: %.cpp
	$(CXX) -o $@ $<

%.d: %.cpp
	$(CXX) -M -MT '$*.test $*.d' -MF $@ $<

.PHONY: test clean
.SECONDARY: $(TESTS:=.test)

include $(TESTS:=.d)