<project name="Pi">

    <property file="build.properties"/>
    <property name="source.dir" value="src"/>
    <property name="class.dir" value="classes"/>
    <property name="library.dir" value="lib"/>

    <target name="clean" description="Delete library and class directories">
        <delete dir="${library.dir}"/>
        <delete dir="${class.dir}"/>
    </target>

    <target name="jar" description="Create the utils.jar archive">
        <mkdir dir="${library.dir}"/>
        <javac srcdir="${source.dir}" 
               destdir="${library.dir}" 
               includes="numbercruncher/mathutils/*.java, numbercruncher/piutils/*.java"/>
        <jar destfile="${library.dir}/utils.jar ">
             <fileset dir="${library.dir}">
                 <include name="numbercruncher/mathutils/*.class"/>
                 <include name="numbercruncher/piutils/*.class"/>
             </fileset>
        </jar>
    </target>

    <target name="compile" depends="jar" description="Compile the pi program">
        <mkdir dir="${class.dir}"/>
        <javac srcdir="${source.dir}" 
               classpath="${library.dir}/utils.jar " 
               destdir="${class.dir}" 
               includes="numbercruncher/program13_3/*.java"/>
    </target>

    <target name="run" depends="jar,compile" description="Run the pi program">
        <java classname="numbercruncher.program13_3.PiBorwein" fork="true">
            <classpath>
                <pathelement path="${library.dir}/utils.jar "/>
                <pathelement path="${class.dir}"/>
            </classpath>
            <arg value="${decimal.places}"/>
        </java>
    </target>

</project>