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

6
7
8
9
10
11
12
13
14
15
16
.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 ####################
###############################################

17
18
19
20
21
22
23
24
25
26
LCC=java -jar ${LCCJAR}
CLASSPATH=.:${LCLJAR}

${LCCJAR} :
	cd ${LCDIR} && make make-compiler

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

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

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