<?xml version="1.0" encoding="UTF-8"?>
<!--

Build System:
..............................................................................

The build system is based on Apache Ant, which is a Java building tool
used in Apache projects.
For more information see refer to "http://jakarta.apache.org/ant/index.html".


Building Instructions:
..............................................................................

First, make sure your current working directory is where this file is located.

You can now launch the ide by typing:

  ant run


Build Targets:
..............................................................................

To display the available targets type:

  ant help

-->

<project name="J-Sim" basedir="." default="help">

  <target name="help">
    <echo message=""/>
    <echo message="DRCL J-Sim+Jacl build file"/>
    <echo message=""/>
    <echo message="Available targets are:"/>
    <echo message=""/>
    <echo message="  run      --&gt; runs the javasim"/>
    <echo message="  compile  --&gt; compiles the source files"/>
    <echo message="  clean    --&gt; cleans up J-Sim binaries"/>
    <echo message="  cleanall --&gt; cleans up all the binaries"/>
    <echo message="  javadoc  --&gt; generates the API documentation"/>
    <echo message=""/>
  </target>

  <target name="init">
    <tstamp><format pattern="d-MMMM-yyyy hh:mm aa" property="now"/></tstamp>
    <tstamp><format pattern="1998-yyyy" property="years"/></tstamp>
    <property name="nickname" value="J-Sim"/>
    <property name="version" value="1.3"/>
    <property name="classes" value="classes"/>
    <property name="jars" value="jars"/>
    <property name="make" value="make"/>
    <property name="script" value="script"/>
    <property name="sources" value="src"/>
    <echo message="${now}"/>
  </target>

  <path id="libs-classpath">
    <fileset dir="jars">
      <include name="*.jar"/>
      <include name="*.zip"/>
    </fileset>
  </path>

  <target name="compile" depends="init" description="Compiles the source files">
    <mkdir dir="${classes}"/>
    <javac destdir="${classes}"
      srcdir="${sources}"
      excludes="${source-excludes}"
      deprecation="on">
      <classpath refid="libs-classpath"/>
    </javac>
	<copy file="${sources}/drcl/ruv/drcl.tcl" todir="${classes}/drcl/ruv"/>
	<copy todir="${classes}/tcl/lang/library">
	  <fileset dir="${sources}/tcl/lang/library"/>
	</copy>
	<copy todir="${classes}/ptolemy/plot/img">
		<fileset dir="${sources}/ptolemy/plot/img">
			<include name="*.gif"/>
		</fileset>
	</copy>
  </target>

  <target name="cleanall" depends="init">
    <delete dir="${classes}"/>
  </target>

  <target name="clean" depends="init">
	<delete includeEmptyDirs="true">
			<fileset dir="${classes}" includes="drcl/,tcl/"/>
    </delete>
  </target>

  <target name="javadoc" depends="init">
    <mkdir dir="docs/javadoc"/>
	<javadoc author="false" bottom="&lt;font size=2&gt;Copyright &#38;copy; ${years} Distributed Real-time Computing Lab (DRCL).  All Rights Reserved. &#38;nbsp; &#38;nbsp; &lt;a href='http://www.javasim.org' target='main'&gt;&lt;i&gt;~ To J-Sim Home ~&lt;/i&gt;&lt;/a&gt;&lt;font&gt;" destdir="docs/javadoc" doctitle="J-Sim API Specification" packagenames="drcl.*" sourcepath="${sources}" use="true" version="false" windowtitle="J-Sim API Specification" header="J-Sim API">
      <classpath refid="libs-classpath"/>
    </javadoc>
  </target>

  <target name="run" depends="compile">
    <java classname="drcl.ruv.System" fork="yes">
      <classpath>
        <pathelement location="${classes}"/>
        <path refid="libs-classpath"/>
      </classpath>
    </java>
  </target>

</project>
