#!/bin/bash

BONNMOTION="/home/denis/omnetpp-4.1/WiSE-MNet/Simulations/Parameters/bonnMotion-2.0"
PACKAGE="edu.bonn.cs.iv.bonnmotion"
CLASSPATH="/home/denis/omnetpp-4.1/WiSE-MNet/Simulations/Parameters/bonnMotion-2.0/classes:/home/denis/omnetpp-4.1/WiSE-MNet/Simulations/Parameters/bonnMotion-2.0/lib/javaproj-1.0.4.jar"
JAVAPATH="/usr/bin"
DOCPATH="/home/denis/omnetpp-4.1/WiSE-MNet/Simulations/Parameters/bonnMotion-2.0/javadoc"
JAVA="$JAVAPATH/java"
JAVAC="$JAVAPATH/javac"
JAVADOC="$JAVAPATH/javadoc"

cd "${BONNMOTION}/src"
test ! -d ../classes && mkdir ../classes
for i in `find . -name "*.java"`; do
	DIR=`dirname $i`
	BASE=`basename $i`
	CLASSFILE="../classes/${DIR}/${BASE%%.*}.class"
	if [ \( "$1" = "all" \) -o \( ! -e "${CLASSFILE}" \) -o \( $i -nt "${CLASSFILE}" \) ]
	then
		echo -n Compiling $BASE ...
		$JAVAC -d ../classes -sourcepath . -classpath "$CLASSPATH" $i
		echo " done."
	fi
done
