<?xml version="1.0" encoding="utf-8" ?>
<project default="all">
  <property name="package.prefix" value="de/tuberlin/polymake" />
  <property name="build.sysclasspath" value="ignore" />

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build.dir}/bundled/java/java" />
  </target>

  <target name="compile" depends="init">
    <sequential>
      <javac
             executable="${javac}"
             srcdir="src"
             destdir="${build.dir}/bundled/java/java"
             failonerror="true"
             debug="${debug}"
             encoding="UTF8">
        <include name="${package.prefix}/**"/>
      </javac>
      <copy todir="${build.dir}/bundled/java/java"
            preservelastmodified="yes">
        <fileset
                dir="src"
                includes="**/*.txt"
                excludes="**/*.java" />
      </copy>
    </sequential>
  </target>

  <target name="native-header" depends="compile">
    <javah
           force="yes"
           class="de.tuberlin.polymake.common.SharedMemoryMatrix"
           outputfile="native/SharedMemoryMatrix_jni.h">
      <classpath location="${build.dir}/bundled/java/java" />
    </javah>
  </target>

  <target name="all" depends="compile,native-header">
    <jar destfile="${build.dir}/jars/${jar.name}">
        <fileset
                 dir="${build.dir}/bundled/java/java"
        	 includes="${package.prefix}/**" />
    </jar>
    <touch file="${build.dir}/jars/${jar.name}" />
  </target>

  <target name="clean">
    <delete quiet="true">
      <fileset dir="${build.dir}/bundled/java/java" />
    </delete>
  </target>
</project>
