<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant build for JOGL's BuildStaticGLInfo and corresponding ANT task.  This 
   - build should not be called directly.  It is invoked from the main 
   - "build.xml" file and relies on the properties set therein.
   -
   - This build has been tested with ANT 1.5.3 and JOGL 1.1.1.1.
   -
   - Public targets:
   -   all:  clean and build BuildStaticGLInfo and StaticGLGen Ant task
   -   clean:  clean all built
  -->
<project name="JOGL.BuildStaticGLInfo" default="all">
    <!-- ================================================================== -->
    <!-- 
       - Declare all paths and user defined variables.
      -->
    <target name="declare" description="Declare properties">
        <!-- The location of the BuildStaticGLInfo source. -->
        <property name="static.gl.src" value="${src.java}/com/jogamp/gluegen/opengl" />
    </target>

    <!-- ================================================================== -->
    <!--
       - Build BuildStaticGLInfo.
      -->
    <target name="build.static.gl" depends="declare">
        <!-- Ensure that the output classes directory exists. -->
        <mkdir dir="${classes}" />

        <!-- Compile BuildStaticGLInfo -->
        <javac srcdir="${src.java}" destdir="${classes}" includes="**/BuildStaticGLInfo.java" source="1.4" debug="true" debuglevel="${javacdebuglevel}"
               includeAntRuntime="false">
            <classpath refid="antlr.classpath" />
        </javac>
        
        <!-- Inform the user that BuildStaticGLInfo has been successfully built. -->
        <echo message="" />
        <echo message="BuildStaticGLInfo has been built successfully." />
    </target>      
    
    <!-- ================================================================== -->
    <!--
       - Build the StaticGLGen ANT task.
      -->
    <target name="build.static.gl.task" depends="declare">
        <!-- Ensure that the output classes directory exists. -->
        <mkdir dir="${classes}" />
            
        <!-- Build the BuildStaticGLInfo ANT task.
           - NOTE:  ONLY the StaticGLGen is built at this time.  BuildStaticGLInfo 
           -        itself is built in a separate task.  -->
        <javac destdir="${classes}" includes="**/StaticGLGenTask.java" source="1.4" debug="true" debuglevel="${javacdebuglevel}"
               includeAntRuntime="false">
	        <src path="${src.java}" />
            <classpath refid="classpath" />
        </javac>
        
        <!-- Inform the user that the BuildStaticGLInfo ANT task has been 
           - successfully built. -->
        <echo message="" />
        <echo message="StaticGLGen ANT task has been built successfully." />
    </target>

    <!-- ================================================================== -->
    <!--
       - Clean up all that is built.  
       - NOTE:  this is a bit heavy-handed as it may delete more than just
       -        what is built with this build.
      -->
    <target name="clean" depends="declare">
        <!-- Create the directory before attempting to delete it.  Deleting
           - non-existant dirs will cause an error. -->
        <mkdir dir="${classes}" />

        <delete includeEmptyDirs="true">
            <fileset dir="${classes}" />
        </delete>
    </target>
    
    <!-- ================================================================== -->
    <!--
       - Build BuildStaticGLInfo and the BuildStaticGLInfo ANT task.
      -->
    <target name="all" depends="declare">
        <!-- Build BuildStaticGLInfo -->
        <antcall target="build.static.gl" />    
    
        <!-- Build the BuildStaticGLInfo ANT task -->
        <antcall target="build.static.gl.task" />
    </target>      

</project>