#!/bin/bash
# a simple script for brewing java... it forces a recompilation of all the
# .java files that are changed after all .class files
# usage:
#   cd to the directory containing your files
#   brew
# this program is made freely available by Roberto Piola 
# http://www.ilpiola.it/roberto
# known bug: if you delete some of the classes (not all), it will not
# recompile them, sorry
CL=`ls -tr *.class | tail -1`
if [ "$CL" == "" ]; then
  echo Recompiling everything
  javac *.java
else
  NL=`find . -name \*.java -newer $CL`
  if [ "$NL" == "" ]; then
    echo nothing to do
  else
    echo Recompiling $NL
    javac $NL
  fi
fi
