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