Makefile 2.05 KB
Newer Older
1
LCDIR=../..
2 3
LABCOMM_JAR=../../compiler/labcomm_compiler.jar
LABCOMM=java -jar $(LABCOMM_JAR) 
4 5 6
CLASSPATH=.:${LCDIR}/lib/java/labcomm.jar
JAVA_PKG=labcommTCPtest
SAMPLENAME=foo
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
${JAVA_PKG}/gen/foo.java: ${LCFILE}.lc
15
	${LABCOMM} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
16 17 18 19 20 21 22 23 24 25 26

${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} $<


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

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


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 43
turtleclient: turtleclient.c ${TLCFILE}.c ${TAUX} ${TAUX:.c=.h}
	${CC} -o $@ turtleclient.c ${TAUX} ${TLCFILE}.c -I${LCLIBDIR} -L${LCLIBDIR} -llabcomm
44
${LCFILE}.c : ${LCFILE}.lc
45
	${LABCOMM} -C ${LCFILE}.lc
46

47
${TLCFILE}.c : ${TLCFILE}.lc
48
	${LABCOMM} -C ${TLCFILE}.lc
49

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

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

58 59 60 61
.PHONY: distclean
distclean: clean 

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

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

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