blob: c98baadd2d6215ba0d3d3ca95ff7eda32640abe1 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
INCLUDES=-I/usr/include/csmith
TARGET_CCOMP=../../../ccomp
TARGET_CC=gcc
#EXECUTE=kvx-cluster --
all:
.SECONDARY:
ifndef CSMITH
CSMITH=csmith
endif
MAX=300
PREFIX=ran%06.f
CCOMPOTS=-static
CCOMPFLAGS+= -fstruct-passing -fbitfields -fno-cse2 -stdlib ../../../runtime
TESTS_C=$(shell seq --format $(PREFIX)/source.c 1 $(MAX))
TESTS_CCOMP_TARGET_S=$(TEST_C:.c=.ccomp.target.s)
TESTS_GCC_TARGET_S=$(TEST_C:.c=.gcc.target.s)
TESTS_GCC_HOST_S=$(TEST_C:.c=.gcc.host.s)
TESTS_CCOMP_TARGET_OUT=$(shell seq --format $(PREFIX)/example.ccomp.target.out 1 $(MAX))
TESTS_GCC_TARGET_OUT=$(shell seq --format $(PREFIX)/example.gcc.target.out 1 $(MAX))
TESTS_GCC_HOST_OUT=$(shell seq --format $(PREFIX)/example.gcc.host.out 1 $(MAX))
TESTS_CMP=$(shell seq --format $(PREFIX)/example.target.cmp 1 $(MAX)) # $(shell seq --format $(PREFIX)/example.host_target.cmp 1 $(MAX))
all: $(TESTS_CCOMP_TARGET_OUT) $(TESTS_GCC_TARGET_OUT) $(TESTS_CCOMP_TARGET_S) $(TESTS_GCC_TARGET_S) $(TESTS_CMP) $(TESTS_C)
tests_c: $(TESTS_C)
tests_s: $(TESTS_CCOMP_TARGET_S)
%.ccomp.target.s : %.c
$(TARGET_CCOMP) $(INCLUDES) $(CCOMPOPTS) $(CCOMPFLAGS) -S -o $@ $<
%.gcc.target.s : %.c
$(TARGET_CC) $(INCLUDES) $(CCOMPOPTS) -S -o $@ $<
%.gcc.host.s : %.c
$(CC) $(INCLUDES) $(CFLAGS) -S -o $@ $<
%.target.o : %.target.s
$(TARGET_CC) -c -o $@ $<
%.host.o : %.host.s
$(CC) $(CFLAGS) -c -o $@ $<
%.target.out : %.target
$(EXECUTE) $< | tee $@
%.host.out : %.host
./$< | tee $@
ran%/example.ccomp.target: ran%/source.ccomp.target.o
$(TARGET_CCOMP) $(CCOMPOPTS) $(CCOMPFLAGS) $+ -o $@
ran%/example.gcc.target: ran%/source.gcc.target.o
$(TARGET_CC) $(TARGET_CFLAGS) $+ -o $@
ran%/example.gcc.host: ran%/source.gcc.host.o
$(CC) $(CFLAGS) $+ -o $@
ran%/source.c:
mkdir -p ran$*
$(CSMITH) --seed $* --output ran$*/source.c
ran%/example.target.cmp : ran%/example.gcc.target.out ran%/example.ccomp.target.out
cmp $+ > $@
ran%/example.host_target.cmp : ran%/example.gcc.host.out ran%/example.ccomp.target.out
cmp $+ > $@
.PHONY: all clean tests_c tests_c
clean:
-rm -rf ran*
|