-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (55 loc) · 1.5 KB
/
Makefile
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
CC=gcc
CLIFLAG =
ECFLAGS=-g $(CLIFLAG)
CFLAGS=-Ih -Iggggc -Ismalljitasm $(ECFLAGS)
LLIBS=ggggc/libggggc.a smalljitasm/libsmalljitasm.a
LIBS=$(LLIBS) -pthread
OBJS=\
exec.o \
tokenizer.o \
parser.o \
ir.o \
jit.o \
intrinsics.o \
value.o
EXTRAS=\
test-tokenizer \
test-parser \
test-ir \
test-jit
TESTS=\
binsearch1 bool1 cmp1 cmp2 cmp3 cmp4 divmul1 eval1 eq1 fib1 fib2 \
global1 loop1 loop2 loop3 obj1 obj2 obj3 obj4 simple1 simple2 simple3 \
simple4 sum1 sum2 sum3 this1 typeof1
all: sdyn
extras: sdyn $(EXTRAS)
sdyn: $(OBJS) main.o $(LLIBS)
$(CC) $(CFLAGS) $(OBJS) main.o $(LIBS) -o $@
test-%: $(OBJS) %-test.o $(LLIBS)
$(CC) $(CFLAGS) $(filter-out $*.o,$(OBJS)) $*-test.o $(LIBS) -o $@
ggggc/libggggc.a: ggggc/ggggc/gc.h
cd ggggc ; $(MAKE)
ggggc/ggggc/gc.h:
cd ggggc-unpatched ; $(MAKE) patch PATCHES=jitpstack
smalljitasm/libsmalljitasm.a:
cd smalljitasm ; $(MAKE)
test: sdyn
mkdir -p tests/results
for i in $(TESTS) ; do \
./sdyn tests/$$i.sdyn > tests/results/$$i || break; \
diff -u tests/results/$$i tests/correct/$$i || break; \
done
%.o: %.c ggggc/ggggc/gc.h
$(CC) $(CFLAGS) -c $< -o $@
%-test.o: %.c ggggc/ggggc/gc.h
$(CC) $(CFLAGS) -DUSE_SDYN_`echo "$*" | tr '[a-z]' '[A-Z]'`_TEST -c $*.c -o $*-test.o
clean:
rm -f sdyn $(EXTRAS) *.o deps
rm -rf tests/results
cd ggggc ; $(MAKE) clean
cd smalljitasm ; $(MAKE) clean
distclean: clean
rm -rf ggggc
include deps
deps:
-$(CC) -Ih -Iggggc -Iggggc-unpatched -Ismalljitasm -MM *.c > deps