<?xml version="1.0"?>
<!--

  build file to build the donated retep tools packages

  $Header: /home/postgres/cvs_root/pgsql-r-v7.2/contrib/retep/build.xml,v 1.1.1.1 2002/02/07 17:51:05 bpalmer Exp $

-->

<!DOCTYPE project [
  <!ENTITY jarname "retepTools.jar">
]>

<project name="retep" default="all" basedir=".">

  <!-- set global properties for this build -->
  <property name="srcdir"  value="." />
  <property name="builddir" value="build" />
  <property name="package" value="uk/org/retep" />
  <property name="jardir"  value="jars" />

  <!-- Some checks used to build dependent on the environment -->
  <target name="checks">
    <available property="jdk1.2+" classname="java.lang.ThreadLocal" />
    <available property="jdk1.3+" classname="java.lang.StrictMath" />
    <available property="jdk1.2e+" classname="javax.sql.DataSource" />
    <available property="xml" classname="org.xml.sax.Parser" />
  </target>

  <target name="warning" depends="checks" unless="jdk1.2+">
    <echo>
*** WARNING: Contributed retep tools need jdk1.2 or later.
***          Compilation NOT done
    </echo>
  </target>


  <!-- default target -->
  <target name="all">
    <antcall target="jar" />
  </target>


  <!-- Builds the various jar files -->
  <target name="jar" depends="compile">
    <jar jarfile="${jardir}/&jarname;" whenempty="fail">
       <fileset dir="${builddir}">
         <include name="**/*.class" />
       </fileset>

       <fileset dir="${srcdir}">
         <include name="**/*.properties" />
       </fileset>
    </jar>
  </target> 


  <!-- Builds the XML Tools -->
  <target name="compile" depends="checks,prepare,warning" if="jdk1.2+">
    <javac srcdir="${srcdir}" destdir="${builddir}">
      <include name="${package}/**" />
      <exclude name="${package}/**" unless="jdk1.2+" />
    </javac>
  </target>


  <!-- Prepares the build by creating a directory to place the class files -->
  <target name="prepare">
    <mkdir dir="${builddir}" />
    <mkdir dir="${jardir}" />
  </target>


  <target name="install" depends="all" if="install.directory">
    <copy todir="${install.directory}" overwrite="true" filtering="off">
      <fileset dir="${jardir}">
        <include name="&jarname;" />
      </fileset>
    </copy>
  </target>


  <target name="uninstall" if="install.directory">
    <delete>
      <fileset dir="${install.directory}">
        <include name="&jarname;" />
      </fileset>
    </delete>
  </target>


  <!-- This target removes any class files from the build directory -->
  <target name="clean">
    <delete quiet="true" dir="${builddir}" />
    <delete quiet="true" dir="${jardir}" />
  </target>

</project>
