<!-- simple generic build file -->

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

  <!-- Properties -->

  <property name="name" value="saxon"/>
  <property name="src" value="src"/>
  <property name="build" value="build"/>
  <property name="build.classes" value="${build}/classes"/>
  <property name="build.doc" value="${build}/api"/>
  <property name="build.lib" value="${build}/lib"/>
  <property name="j2se.javadoc" value="/usr/share/javadoc/j2se"/>
  <property name="jdom.javadoc" value="/usr/share/javadoc/jdom"/>

  <!-- Targets -->

  <!-- Prepare build directories -->
  <target name="prepare">
    <mkdir dir="${src}"/>
    <mkdir dir="${build}"/>
    <mkdir dir="${build.classes}"/>
    <mkdir dir="${build.lib}"/>
    <mkdir dir="${build.doc}"/>
    <copy todir="${src}">
      <fileset dir="." includes="com/**,org/**,net/**"/>
    </copy>
  </target>

  <!-- Kill all the created directories -->
  <target name="clean">
    <delete dir="${build}"/>
    <delete dir="${src}"/>
  </target>

  <!-- Build classes -->
  <target name="classes" depends="prepare">
    <javac srcdir="${src}" destdir="${build.classes}" encoding="ISO-8859-1"/>
  </target>

  <!-- Build jar archives -->

  <target name="jar" depends="classes">
    <jar jarfile="${build.lib}/${name}.jar"
         basedir="${build.classes}">
      <manifest>
        <attribute name="Main-Class" value="net.sf.saxon.Transform" />
      </manifest>
      <service type="javax.xml.transform.TransformerFactory"
            provider="net.sf.saxon.TransformerFactoryImpl"/>
      <service type="javax.xml.xpath.XPathFactory">
        <provider classname="net.sf.saxon.xpath.XPathFactoryImpl"/>
        <provider classname="http\://java.sun.com/jaxp/xpath/dom:    net.sf.saxon.xpath.XPathFactoryImpl"/>
        <provider classname="http\://saxon.sf.net/jaxp/xpath/om:     net.sf.saxon.xpath.XPathFactoryImpl"/>
      </service>
    </jar>
  </target>

  <!-- Build the full JavaDocs -->
  <target name="javadoc" depends="prepare">
    <javadoc sourcepath="${src}"
            destdir="${build.doc}"
            doctitle="${name} JavaDoc"
            windowtitle="${name} JavaDoc"
            package="true"
            author="true"
            version="true"
            packagenames="net.sf.saxon.*,org.w3c.xsl.*"
            encoding="ISO-8859-1"
      >
      <link href="${j2se.javadoc}"/>
      <link href="${jdom.javadoc}"/>
    </javadoc>
  </target>

  <!-- Build everything -->
  <target name="all" depends="jar,javadoc"/>

</project>
