<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Copyright (c) 2007 by Chris Gray, /k/ Embedded Java Solutions.          -->
<!-- All rights reserved.                                                    -->
<!--                                                                         -->
<!-- Redistribution and use in source and binary forms, with or without      -->
<!-- modification, are permitted provided that the following conditions      -->
<!-- are met:                                                                -->
<!-- 1. Redistributions of source code must retain the above copyright       -->
<!--    notice, this list of conditions and the following disclaimer.        -->
<!-- 2. Redistributions in binary form must reproduce the above copyright    -->
<!--    notice, this list of conditions and the following disclaimer in the  -->
<!--    documentation and/or other materials provided with the distribution. -->
<!-- 3. Neither the name of /k/ Embedded Java Solutions nor the names of     -->
<!--    other contributors may be used to endorse or promote products        -->
<!--    derived from this software without specific prior written permission.-->
<!--                                                                         -->
<!-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED          -->
<!-- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF    -->
<!-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.    -->
<!-- IN NO EVENT SHALL /K/ EMBEDDED JAVA SOLUTIONS OR OTHER CONTRIBUTORS BE  -->
<!-- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR     -->
<!-- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF    -->
<!-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR         -->
<!-- BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,   -->
<!-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE    -->
<!-- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN  -->
<!-- IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<project name="mika" default="main" basedir=".">
  <property name="build.dir" value="${basedir}/build/"/>
  <property name="tools.dir" value="${build.dir}tools/"/>
  <property name="ant.dir" value="${basedir}/ant/"/>
  <property name="release.dir" value="${basedir}/release/"/>

  <!-- build targets -->
  <target name="main" depends="check,tool">
    <taskplatform list="${PLATFORM}" target="buildplatform"/>
  </target>

  <target name="sample">
    <subant target="sample" antfile="sample.xml" buildpath="${ant.dir}"/>
  </target>

  <target name="tests">
    <subant target="tool" antfile="tool.xml" buildpath="${ant.dir}"/>
  </target>

  <target name="source" depends="check,tool">
    <subant antfile="mika_build.xml" buildpath="${ant.dir}" target="source">
      <property name="ANT.PLATFORM" value="${PLATFORM}"/>
      <property name="do.javadoc" value="${want.javadoc}"/>
    </subant>
  </target>
  
  <!-- Clean targets -->
  <target name="cleanall">
    <delete dir="${build.dir}" />
    <delete dir="${release.dir}" />
  </target>

  <target name="clean" depends="check,tool">
    <taskplatform list="${PLATFORM}" target="cleanplatform"/>
  </target>

  <!-- Helper targets ... -->
  <target name="cleanplatform">
    <echo message="Deleting platform files '${platform}'" />
    <delete dir="${build.dir}${platform}" />
  </target>

  <target name="check">
    <fail message="please provide a platform definition ex: -DPLATFORM=pc" unless="PLATFORM"/>
  </target>

  <target name="tool">
    <subant antfile="build.xml" buildpath="${ant.dir}"/>
    <taskdef name="taskplatform" classname="be.kiffer.mika.ant.PlatformParser"
             classpath="${tools.dir}/ant-mika.jar"/>
  </target>

  <target name="buildplatform">
    <echo message="Building platform '${platform}'" />
    <subant antfile="mika_build.xml" buildpath="${ant.dir}">
      <property name="ANT.PLATFORM" value="${platform}"/>
    </subant>
  </target>
</project>

