JAR=filler.jar
# where Filler keeps its files
DEST=/usr/local/filler
# where the executable should go
FILLERPATH=/usr/local/bin
RM=/bin/rm
DIR=src/friendless/games/filler

$(JAR):
	mkdir classes || $(RM) -rf classes/*
	javac -d classes src/friendless/awt/*.java
	javac -classpath classes -d classes $(DIR)/*.java $(DIR)/player/*.java $(DIR)/remote/*.java $(DIR)/remote/messages/*.java
	cp -R res/* classes
	cd classes && jar cmf ../other/metainfo.txt $(JAR) friendless
	mv classes/$(JAR) .

clean:
	$(RM) -rf classes
	# existing tars
	$(RM) -f *.tgz
	# JBuilder backup files
	find . -name "*~" -print | xargs $(RM) -f
	# xv rubbish?
	$(RM) -rf res/friendless/games/filler/.xvpics

install: clean
	install -m644 -D $(JAR) $(DEST)/$(JAR)
	install -m666 -D other/ratings.ser $(DEST)/ratings.ser
	install -m755 -D other/filler $(FILLERPATH)/filler

uninstall:
	$(RM) -rf $(DEST)
	$(RM) $(FILLERPATH)/filler

windows: $(JAR)
	mkdir windows || $(RM) -rf windows/*
	cp -f $(JAR) windows
	cp -f other/filler.bat windows
	cp -f other/ratings.ser windows
	cp -f other/filler.ico windows
