Makefile 2.01 KB
Newer Older
1
LCDIR=../..
2
LCC=java -jar ${LCDIR}/compiler/labcomm_compiler.jar
3
4
5
CLASSPATH=.:${LCDIR}/lib/java/labcomm.jar
JAVA_PKG=labcommTCPtest
SAMPLENAME=foo
6
LCLIBDIR=${LCDIR}/lib/c
7
8

LCFILE=jg
9
AUX=enc.c dec.c
10
11
TLCFILE=turtle1
TAUX=turtle_enc.c turtle_dec.c
12

13
14
15
16
17
18
19
20
21
22
23
24
25
${JAVA_PKG}/gen/foo.java: ${LCFILE}.lc
	${LCC} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<

${JAVA_PKG}/gen/${SAMPLENAME}.class: ${JAVA_PKG}/gen/${SAMPLENAME}.java
	javac -cp ${CLASSPATH} $<

${JAVA_PKG}/server/TestServer.class: ${JAVA_PKG}/server/TestServer.java ${JAVA_PKG}/gen/${SAMPLENAME}.class
	javac -cp ${CLASSPATH} $<

${JAVA_PKG}/client/TestClient.class: ${JAVA_PKG}/client/TestClient.java ${JAVA_PKG}/gen/${SAMPLENAME}.class
	javac -cp ${CLASSPATH} $<


26
.PHONY: runjavaserver
27
28
29
runjavaserver : ${JAVA_PKG}/server/TestServer.class
	java -cp ${CLASSPATH} $(<:.class=)

30
.PHONY: runjavaclient 
31
32
33
34
runjavaclient : ${JAVA_PKG}/client/TestClient.class
	java -cp ${CLASSPATH} $(<:.class=)


35
36
37
38
39
40
client: client.c ${LCFILE}.c ${AUX} ${AUX:.c=.h}
	${CC} -o $@ client.c ${AUX} ${LCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm

testserver: testserver.c ${LCFILE}.c ${AUX} ${AUX:.c=.h}
	${CC} -o $@ testserver.c ${AUX} ${LCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm
	
41
42
turtleclient: turtleclient.c ${TLCFILE}.c ${TAUX} ${TAUX:.c=.h}
	${CC} -o $@ turtleclient.c ${TAUX} ${TLCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm
43
44
45
${LCFILE}.c : ${LCFILE}.lc
	${LCC} -C ${LCFILE}.lc

46
47
${TLCFILE}.c : ${TLCFILE}.lc
	${LCC} -C ${TLCFILE}.lc
48

49
50
all: client testserver ${JAVA_PKG}/server/TestServer.class ${JAVA_PKG}/client/TestClient.class turtleclient

51
.PHONY: clean
52
clean :
53
54
55
	rm -f ${LCFILE}.c ${LCFILE}.h client testserver turtleclient
	rm -f ${JAVA_PKG}/server/*.class ${JAVA_PKG}/client/*.class 
	rm -f ${JAVA_PKG}/gen/* 
56

57
58
59
60
.PHONY: distclean
distclean: clean 

.PHONY: runclient
61
62
63
runclient : client
	LD_LIBRARY_PATH=${LCLIBDIR} ./$< localhost 9999

64
.PHONY: runserver
65
66
runserver : testserver
	LD_LIBRARY_PATH=${LCLIBDIR} ./$< 9999
67

68
.PHONY: runtclient
69
70
runtclient : turtleclient
	LD_LIBRARY_PATH=${LCLIBDIR} ./$< localhost 8082