1# Usage: make test.N.report
2#
3# COUNT can be over-ridden to change the number of tests generated per
4# file, and TESTARGS is used to change the type generation. Make sure
5# to 'make clean' after changing either of these parameters.
6
7ABITESTGEN := ../ABITestGen.py
8TESTARGS := --max-args 0 --test-layout
9COUNT := 1000
10TIMEOUT := 5
11
12CFLAGS := -std=gnu99
13
14X_COMPILER := llvm-gcc
15Y_COMPILER := clang
16CC := gcc
17
18ifeq (0, 0)
19X_CFLAGS := -m32
20Y_CFLAGS := -m32
21CC_CFLAGS := -m32
22else
23X_CFLAGS := -m64
24Y_CFLAGS := -m64
25CC_CFLAGS := -m64
26endif
27
28.PHONY: test.%.report
29test.%.report: test.%.x.diff test.%.y.diff
30	@for t in $^; do \
31		if [ -s $$t ]; then \
32			echo "TEST $*: $$t failed"; \
33		fi; \
34	done
35
36.PHONY: test.%.build
37test.%.build: test.%.ref test.%.x test.%.y
38	@true
39
40###
41
42.PRECIOUS: test.%.x.diff
43test.%.x.diff: test.%.ref.out test.%.x.out
44	-diff $^ > $@
45.PRECIOUS: test.%.y.diff
46test.%.y.diff: test.%.ref.out test.%.y.out
47	-diff $^ > $@
48
49.PRECIOUS: test.%.out
50test.%.out: test.%
51	-./$< > $@
52
53.PRECIOUS: test.%.ref
54test.%.ref: test.%.c
55	$(CC) $(CFLAGS) $(CC_CFLAGS) -o $@ $^
56.PRECIOUS: test.%.x
57test.%.x: test.%.c
58	$(X_COMPILER) $(CFLAGS) $(X_CFLAGS) -o $@ $^
59.PRECIOUS: test.%.y
60test.%.y: test.%.c
61	$(Y_COMPILER) $(CFLAGS) $(Y_CFLAGS) -o $@ $^
62
63.PRECIOUS: test.%.c
64test.%.c: $(ABITESTGEN)
65	$(ABITESTGEN) $(TESTARGS) -o $@ --min=$(shell expr $* '*' $(COUNT))  --count=$(COUNT)
66
67clean:
68	rm -f test.* *~
69