# Steve Revilak
# cs680                Fall 2001
# Assignment 4
# File: ~srevilak/cs680/p4/Makefile
# 
# $Id: Makefile,v 1.15 2001/11/27 16:17:01 srevilak Exp $
#
# Build Directives for the pool applet

INSTALLDIR = /home/srevilak/public_html/pool
JAVADOC_DIR = $(INSTALLDIR)/javadoc
DIRECTORIES = $(INSTALLDIR) $(JAVADOC_DIR)

java_files = Pool.java  \
	PoolTable.java \
	Ball.java  \
	SolidBall.java  \
	StripedBall.java \
	CueBall.java \
	Pocket.java \
	MotionUtils.java \
	VectorQuantity.java \
	HiResPoint.java

html_files = pool.html

# figure out what the names of the different classfiles are
class_files = $(subst .java,.class,$(java_files))

# install names of the various stuffs
i_html_files = $(addprefix $(INSTALLDIR)/,$(html_files))

# for web-viewing, deploy the applet in a jar file
jarfile = $(INSTALLDIR)/pool.jar

JAVAC = javac
JFLAGS = -g -deprecation

# rule for installing html files
#
$(INSTALLDIR)/%.html: %.html
	install -m 0644 $< $@

# Pattern rule for building class files
#
%.class: %.java
	$(JAVAC) $(JFLAGS) $<

# Default target:
#  build the class files, deploy html page and jar file
#
all:	$(DIRECTORIES) $(i_html_files) $(class_files) $(jarfile)

$(DIRECTORIES):
	mkdir -p $@

jar: $(jarfile)

$(jarfile): $(class_files)
	rm -f pool.jar
	jar -cvf pool.jar *.class
	mv -f pool.jar $(jarfile)

.PHONY: test clean tags jar javadoc deploy


# Build the set of javadoc for the application
#
javadoc: $(java_files) $(DIRECTORIES)
	javadoc -protected \
	   -windowtitle "Pool Applet" \
	   -d $(JAVADOC_DIR) \
	   -version \
	   -author \
	  $(java_files)

tags: 
	etags --language=java *.java

clean:
	rm -f *~
	rm -f *.class

clean-all: clean
	rm -f $(i_html_files)
	rm -f $(jarfile)

