aboutsummaryrefslogtreecommitdiffstats
path: root/test/abi/Makefile
blob: eb9ca292ceeb08e75e9fa9af5247f7e524ac7003 (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
include ../../Makefile.config

CCOMP=../../ccomp -stdlib ../../runtime
CCOMPFLAGS=
CFLAGS=-O -Wno-overflow -Wno-constant-conversion

TESTS=fixed.compcert fixed.cc2compcert fixed.compcert2cc \
     vararg.compcert vararg.cc2compcert vararg.compcert2cc \
     struct.compcert struct.cc2compcert struct.compcert2cc

all: $(TESTS)

all_s: fixed_def_compcert.s fixed_use_compcert.s \
       vararg_def_compcert.s vararg_use_compcert.s \
       struct_def_compcert.s struct_use_compcert.s

test:
	@set -e; for t in $(TESTS); do \
          SIMU='$(SIMU)' ARCH=$(ARCH) MODEL=$(MODEL) ABI=$(ABI) SYSTEM=$(SYSTEM) ./Runtest $$t; \
         done

generator.exe: generator.ml
	ocamlopt -g -o $@ generator.ml

clean::
	rm -f generator.exe *.cm[iox]

fixed_decl.h: generator.exe
	./generator.exe -rnd 500 -o fixed

fixed_def.c fixed_use.c: fixed_decl.h

clean::
	rm -f fixed_decl.h fixed_def.c fixed_use.c

vararg_decl.h: generator.exe
	./generator.exe -vararg -rnd 500 -o vararg

vararg_def.c vararg_use.c: vararg_decl.h

clean::
	rm -f vararg_decl.h vararg_def.c vararg_use.c

struct_decl.h: generator.exe
	./generator.exe -structs -o struct

struct_def.c struct_use.c: struct_decl.h

clean::
	rm -f struct_decl.h struct_def.c struct_use.c

struct%.o: CCOMPFLAGS += -fstruct-passing -dclight

%_compcert.o: %.c
	$(CCOMP) $(CCOMPFLAGS) -c -o $@ $*.c
%_cc.o: %.c
	$(CC) $(CFLAGS) -c -o $@ $*.c

%_compcert.s: %.c
	$(CCOMP) -S -o $@ $*.c
%_cc.s: %.c
	$(CC) $(CFLAGS) -S -o $@ $*.c

%.compcert: %_def_compcert.o %_use_compcert.o
	$(CCOMP) -o $@ $*_def_compcert.o $*_use_compcert.o

%.cc2compcert: %_def_compcert.o %_use_cc.o
	$(CCOMP) -o $@ $*_def_compcert.o $*_use_cc.o

%.compcert2cc: %_def_cc.o %_use_compcert.o
	$(CCOMP) -o $@ $*_def_cc.o $*_use_compcert.o

clean::
	rm -f *.[os] *.compcert *.cc2compcert *.compcert2cc *.light.c