Makefile 2.44 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
	gen/%/java_code 
	PYTHONPATH=../lib/python ./test_encoder_decoder.py \
		--signatures=gen/$*/signatures.py \
23
		--test tee gen/$*/testdata \
24
		--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
Anders Blomdell's avatar
Anders Blomdell committed
28
29
30
31
.PRECIOUS: gen/%/.dir
gen/%/.dir:
	mkdir -p gen/$*
	touch $@
32
33

.PRECIOUS: gen/%/typeinfo
Anders Blomdell's avatar
Anders Blomdell committed
34
gen/%/typeinfo:	%.lc Makefile | gen/%/.dir
35
36
37
	$(LABCOMM) --typeinfo=$@ $<

.PRECIOUS: gen/%/signatures.py
Anders Blomdell's avatar
Anders Blomdell committed
38
gen/%/signatures.py: %.lc Makefile | gen/%/.dir
39
40
41
42
	$(LABCOMM) --python=$@ $<

# C relay test rules
.PRECIOUS: gen/%/c_code.h gen/%/c_code.c
Anders Blomdell's avatar
Anders Blomdell committed
43
gen/%/c_code.h gen/%/c_code.c: %.lc Makefile | gen/%/.dir
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	$(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
Anders Blomdell's avatar
Anders Blomdell committed
62
gen/%/cs_code.cs: %.lc Makefile | gen/%/.dir
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
	$(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
Anders Blomdell's avatar
Anders Blomdell committed
80
gen/%/java_code: %.lc | gen/%/.dir
81
82
83
	mkdir -p $@
	$(LABCOMM) --java=$@ $<

Anders Blomdell's avatar
Anders Blomdell committed
84
85
86
87
88
89
90
.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 $<