CS243HOME=/afs/ir/class/cs243

CLASSPATH=/afs/ir/systems/@sys/pubsw/package/Languages/jdk-1.4.1/sun4x_56/apps/jdk-1.4.1/jre/lib/rt.jar:$(CS243HOME)/joeq.jar:.

JAVAC=$(CS243HOME)/bin/jikes-$(HOSTTYPE) +E

JAVA=java

ANALYSIS_CLASSES=Flow.class MySolver.class

REACHING_CLASS=ReachingDefs.class

CONSPROP_CLASS=ConstantProp.class

LIVENESS_CLASS=Liveness.class

ALL_CLASSES=$(ANALYSIS_CLASSES) $(CONSPROP_CLASS) $(REACHING_CLASS) $(LIVENESS_CLASS)

%.class:%.java
	@echo Compiling $?
	@$(JAVAC) -classpath $(CLASSPATH) $?

.PHONY:all all_java test test_constantprop test_reachingdefs

all: $(ALL_CLASSES)

solver:$(ANALYSIS_CLASSES)

reachingdefs:$(REACHING_CLASS)

test_constantprop: $(ANALYSIS_CLASSES) $(CONSPROP_CLASS)
	@echo "Testing	constant propagation..."
	@if $(JAVA) -classpath $(CLASSPATH) Flow MySolver ConstantProp \
	test | diff - test.cp.out > /dev/null ;\
	then echo "Success!"; else echo "Failed..."; fi

test_liveness: $(ANALYSIS_CLASSES) $(LIVENESS_CLASS)
	@echo "Testing	liveness analysis..."
	@if $(JAVA) -classpath $(CLASSPATH) Flow MySolver Liveness \
	test | diff - test.lv.out > /dev/null ;\
	then echo "Success!"; else echo "Failed..."; fi

test_reachingdefs: $(ANALYSIS_CLASSES) $(REACHING_CLASS)
	@echo "Testing	reaching definitions..."
	@if $(JAVA) -classpath $(CLASSPATH) Flow MySolver ReachingDefs \
	test | diff - test.rd.out > /dev/null ;\
	then echo "Success!"; else echo "Failed..."; fi

constantprop.out: $(ANALYSIS_CLASSES) $(CONSPROP_CLASS)
	@echo "Storing output of constant propagation in constantprop.out"
	@$(JAVA) -classpath $(CLASSPATH) Flow MySolver ConstantProp \
	test > constantprop.out

reachingdefs.out: $(ANALYSIS_CLASSES) $(REACHING_CLASS)
	@echo "Storing output of reaching definitions in reachingdefs.out"
	@$(JAVA) -classpath $(CLASSPATH) Flow MySolver ReachingDefs \
	test > reachingdefs.out

liveness.out: $(ANALYSIS_CLASSES) $(LIVENESS_CLASS)
	@echo "Storing output of liveness analysis in liveness.out"
	@$(JAVA) -classpath $(CLASSPATH) Flow MySolver Liveness \
	test > liveness.out

test:test_constantprop test_reachingdefs test_liveness

clean:
	rm -f $(ALL_CLASSES) *\$$*.class *~
