<!-- build configuration -->
<project name="chuchu" default="compile" basedir=".">

  <!-- configuration parameters -->
  <property name="app.name"       value="chuchu"/>
  <property name="deploy.home"    value="dist"/>
  <property name="dist.home"      value="${deploy.home}"/>
  <property name="dist.jar"       value="${app.name}.jar"/>
  <property name="javadoc.home"   value="${deploy.home}/docs"/>
  <property name="build.compiler" value="jikes"/>
  <property name="java.libraries" value="/usr/share/java"/>

  <!-- prepares the application directories -->
  <target name="prepare">
    <mkdir dir="${deploy.home}"/>
    <mkdir dir="${deploy.home}/classes"/>
    <mkdir dir="${javadoc.home}"/>
  </target>

  <!-- cleans out the installed application -->
  <target name="clean">
    <delete dir="${deploy.home}"/>
  </target>

  <!-- build the java class files -->
  <target name="compile" depends="prepare">
    <javac srcdir="src/java" destdir="${deploy.home}/classes"
           debug="off" optimize="on" deprecation="off">
      <classpath>
        <fileset dir="${java.libraries}" includes="**/*.jar"/>
        <fileset dir="lib" includes="**/*.jar"/>
        <pathelement location="${deploy.home}/classes"/>
      </classpath>
    </javac>
  </target>

  <!-- build the javadoc documentation -->
  <target name="javadoc" depends="prepare">
    <javadoc sourcepath="src/java"
             packagenames="com.samskivert.*"
             classpath="${deploy.home}/classes"
             destdir="${javadoc.home}"/>
  </target>

  <!-- the default target is to rebuild everything -->
  <target name="all" depends="clean,prepare,compile,javadoc"/>

  <!-- builds our distribution files (war and jar) -->
  <target name="dist" depends="prepare,compile">
    <jar jarfile="${dist.home}/${dist.jar}"
         basedir="${deploy.home}/classes"/>
  </target>

</project>
