Makefile 2.41 KB
Newer Older
1
TESTS=basic simple nested
2
3
4
LABCOMM_JAR=../compiler/labComm.jar
LABCOMM=java -jar $(LABCOMM_JAR) 

Anders Blomdell's avatar
Anders Blomdell committed
5
6
7
all:	

test: $(TESTS:%=test_%)
8
9
10
11
12
13
14
15
#	PYTHONPATH=../lib/python \
#		./test_encoder_decoder.py --labcomm="$(LABCOMM)" basic.lc

.PHONY: clean
clean:
	rm -rf gen

.PHONY: test_%
Anders Blomdell's avatar
Anders Blomdell committed
16
17
test_%: gen/%/signatures.py \
	gen/%/c_relay \
18
	gen/%/cs_relay.exe \
Anders Blomdell's avatar
Anders Blomdell committed
19
	gen/%/java_relay.class \
20
21
22
23
24
	gen/%/java_code 
	PYTHONPATH=../lib/python ./test_encoder_decoder.py \
		--signatures=gen/$*/signatures.py \
		--test /bin/tee gen/$*/testdata \
		--test gen/$*/c_relay /dev/stdin /dev/stdout \
Anders Blomdell's avatar
Anders Blomdell committed
25
26
27
		--test mono gen/$*/cs_relay.exe /dev/stdin /dev/stdout \
		--test java \\-cp gen/$*:../lib/java/labcomm.jar java_relay \
			    /dev/stdin /dev/stdout
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
81
82
.PRECIOUS: gen/%/
gen/%/:
	mkdir -p $@

.PRECIOUS: gen/%/typeinfo
gen/%/typeinfo:	%.lc Makefile | gen/%/
	$(LABCOMM) --typeinfo=$@ $<

.PRECIOUS: gen/%/signatures.py
gen/%/signatures.py: %.lc Makefile | gen/%/
	$(LABCOMM) --python=$@ $<

# C relay test rules
.PRECIOUS: gen/%/c_code.h gen/%/c_code.c
gen/%/c_code.h gen/%/c_code.c: %.lc Makefile | gen/%/
	$(LABCOMM) --c=gen/$*/c_code.c --h=gen/$*/c_code.h $<

.PRECIOUS: gen/%/c_relay.c
gen/%/c_relay.c: gen/%/typeinfo relay_gen_c.py Makefile
	./relay_gen_c.py $< > $@

.PRECIOUS: gen/%/c_relay
gen/%/c_relay: gen/%/c_relay.c gen/%/c_code.c Makefile
	$(CC) $(CFLAGS) -o $@ $< -I../lib/c -I. \
		-DLABCOMM_FD_OMIT_VERSION \
		-DLABCOMM_ENCODER_LINEAR_SEARCH \
		gen/$*/c_code.c \
		../lib/c/labcomm.c \
		../lib/c/labcomm_fd_*.c \
		../lib/c/labcomm_dynamic_buffer_writer.c 

# C# relay test rules
.PRECIOUS: gen/%/cs_code.cs
gen/%/cs_code.cs: %.lc Makefile | gen/%/
	$(LABCOMM) --cs=$@ $<

.PRECIOUS: gen/%/cs_relay.cs
gen/%/cs_relay.cs:  gen/%/typeinfo relay_gen_cs.py Makefile
	./relay_gen_cs.py $< > $@

.PRECIOUS: gen/%/labcomm.dll
gen/%/labcomm.dll:
	ln -s ../../../lib/csharp/labcomm.dll $@

.PRECIOUS: gen/%/cs_relay.exe
gen/%/cs_relay.exe: gen/%/cs_relay.cs gen/%/cs_code.cs \
		    gen/%/labcomm.dll Makefile
	mcs -out:$@ $(filter %.cs, $^) -lib:../lib/csharp/ -r:labcomm

# Java relay test rules
.PRECIOUS: gen/%/java_code
gen/%/java_code: %.lc | gen/%/
	mkdir -p $@
	$(LABCOMM) --java=$@ $<

Anders Blomdell's avatar
Anders Blomdell committed
83
84
85
86
87
88
89
.PRECIOUS: gen/%/java_relay.java
gen/%/java_relay.java: gen/%/typeinfo relay_gen_java.py Makefile
	./relay_gen_java.py $< > $@

.PRECIOUS: gen/%/java_relay.class
gen/%/java_relay.class: gen/%/java_relay.java gen/%/java_code Makefile
	javac -d gen/$*  -cp ../lib/java/labcomm.jar:gen/$*/java_code $<