Makefile 1.83 KB
Newer Older
1
LCDIR=../..
2
3
LABCOMM_JAR=../../compiler/labcomm_compiler.jar
LABCOMM=java -jar $(LABCOMM_JAR)
4
LCLJAR=${LCDIR}/lib/java/labcomm.jar  # the LabComm library
5
6
JAVA_PKG=labcommTCPtest

7
8
9
10
11
12
13
14
15
16
17
.PHONY : clean run runserver runOSserver runclient

#### The main example #########################

run : ${JAVA_PKG}/Example.class ${JAVA_PKG}/server/TestServer.class ${JAVA_PKG}/client/TestClient.class
	java -cp ${CLASSPATH} $(<:.class=)

###############################################
### dependencies and parts ####################
###############################################

18
19
CLASSPATH=.:${LCLJAR}

20
${LABCOMM_JAR} :
21
22
23
24
25
26
	cd ${LCDIR} && make make-compiler

${LCLJAR} :
	cd ${LCDIR}/lib/java && make labcomm.jar

${JAVA_PKG}/gen/FooSample.java: test.lc ${LCCJAR}
27
	${LABCOMM} --javapackage=${JAVA_PKG}.gen --java=${JAVA_PKG}/gen $<
28

29
${JAVA_PKG}/gen/FooSample.class: ${JAVA_PKG}/gen/FooSample.java test.lc ${LCLJAR}   
30
31
	javac -cp ${CLASSPATH} $<

32
${JAVA_PKG}/Example.class: ${JAVA_PKG}/Example.java ${JAVA_PKG}/gen/FooSample.class ${LCLJAR} 
33
34
	javac -cp ${CLASSPATH} $<

35
${JAVA_PKG}/server/TestServer.class: ${JAVA_PKG}/server/TestServer.java ${JAVA_PKG}/gen/FooSample.class ${LCLJAR} 
36
37
	javac -cp ${CLASSPATH} $<

38
${JAVA_PKG}/server/OneShotServer.class: ${JAVA_PKG}/server/OneShotServer.java ${JAVA_PKG}/gen/FooSample.class ${LCLJAR} 
39
40
	javac -cp ${CLASSPATH} $<

41
${JAVA_PKG}/client/TestClient.class: ${JAVA_PKG}/client/TestClient.java ${JAVA_PKG}/gen//FooSample.class ${LCLJAR} 
42
43
44
45
46
	javac -cp ${CLASSPATH} $<

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

47
48
49
runOSserver : ${JAVA_PKG}/server/OneShotServer.class
	java -cp ${CLASSPATH} $(<:.class=)

50
51
52
53
runclient : ${JAVA_PKG}/client/TestClient.class
	java -cp ${CLASSPATH} $(<:.class=)

clean :
54
55
56
57
58
	rm -f ${JAVA_PKG}/server/*.class 
	rm -f ${JAVA_PKG}/client/*.class 
	rm -f ${JAVA_PKG}/gen/* 

distclean: clean