# BlinkenSim
# version 0.1 date 2006-07-28
# Copyright (C) 2004-2006: Stefan Schuermans <stefan@blinkenarea.org>
# Copyleft: GNU public license - http://www.gnu.org/copyleft/gpl.html
# a blinkenarea.org project

BLINKEN_LIB=../BlinkenLibJava/BlinkenLib.jar

JAVAC=javac
JAR=jar
KEYTOOL=keytool
JARSIGNER=jarsigner
KEYPASS=BlinkenLib
JAVA=java
P=org/blinkenarea/BlinkenSim

CLASSPATH=.:$(BLINKEN_LIB)
CLASS_FILES=$(P)/FrameReceiver.class $(P)/DataSource.class \
            $(P)/DynMcufClientRecv.class $(P)/DynMcufClientSend.class $(P)/DynMcufClient.class \
            $(P)/MoviePlayerTimerTask.class $(P)/MoviePlayer.class $(P)/PlaylistPlayer.class \
            $(P)/BlinkenSim.class

.phony: all clean jar

all: jar

clean:
	rm -f $(CLASS_FILES) BlinkenSim.jar

jar: BlinkenSim.jar

%.class: %.java
	$(JAVAC) -classpath $(CLASSPATH) $<

BlinkenSim.keystore:
	$(KEYTOOL) -genkey -alias BlinkenSim -keystore BlinkenSim.keystore -keypass $(KEYPASS) -storepass $(KEYPASS)

BlinkenSim.jar: BlinkenSim.keystore $(CLASS_FILES)
	$(JAR) cf BlinkenSim.jar $(CLASS_FILES)
	rm -rf jar.tmp
	mkdir jar.tmp
	cat $(BLINKEN_LIB) | ( cd jar.tmp ; $(JAR) x )
	rm -rf jar.tmp/META-INF
	$(JAR) uf BlinkenSim.jar -C jar.tmp .
	rm -rf jar.tmp
	$(JARSIGNER) -keystore BlinkenSim.keystore -storepass $(KEYPASS) BlinkenSim.jar BlinkenSim

