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

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

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
${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} $<


runjavaserver : ${JAVA_PKG}/server/TestServer.class
	java -cp ${CLASSPATH} $(<:.class=)

runjavaclient : ${JAVA_PKG}/client/TestClient.class
	java -cp ${CLASSPATH} $(<:.class=)


34
35
36
37
38
39
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
	
40
41
turtleclient: turtleclient.c ${TLCFILE}.c ${TAUX} ${TAUX:.c=.h}
	${CC} -o $@ turtleclient.c ${TAUX} ${TLCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm
42
43
44
${LCFILE}.c : ${LCFILE}.lc
	${LCC} -C ${LCFILE}.lc

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

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

.PHONY: clean runclient runserver runjavaserver runjavaclient turtleclient
51
clean :
52
	rm ${LCFILE}.c ${LCFILE}.h client testserver turtleclient
53
	rm  ${JAVA_PKG}/server/*.class ${JAVA_PKG}/client/*.class ${JAVA_PKG}/gen/* 
54
55
56
57
58
59

runclient : client
	LD_LIBRARY_PATH=${LCLIBDIR} ./$< localhost 9999

runserver : testserver
	LD_LIBRARY_PATH=${LCLIBDIR} ./$< 9999
60
61
62

runtclient : turtleclient
	LD_LIBRARY_PATH=${LCLIBDIR} ./$< localhost 8082