blob: f497dba607ca7f9a17c47da2897a6dab37cac003 [file] [log] [blame]
<project name="JFlex" default="help">
<!-- ==================== properties ============================== -->
<!-- use any of these files to override properties -->
<property file="build.properties" />
<property file="${user.home}/.jflex.properties" />
<!-- location of development tools necessary for the build -->
<property name="tools.dir" value="../tools"/>
<!-- override these if you want to use your own versions -->
<property name="jflex.jar" value="${tools.dir}/JFlex.jar" />
<property name="cup.jar" value="${tools.dir}/java_cup.jar" />
<property name="junit.jar" value="${tools.dir}/junit.jar" />
<!-- where to get tool jars from -->
<property name="jflex.jar.url"
value="http://jflex.sourceforge.net/jar/stable/JFlex.jar" />
<property name="cup.jar.url"
value="http://jflex.sourceforge.net/jar/stable/java_cup.jar" />
<property name="junit.jar.url"
value="http://jflex.sourceforge.net/jar/stable/junit.jar" />
<!-- ==================== targets ================================= -->
<target name="help" description="show help message">
<echo message="Ant build file for JFlex. Useful targets:"/>
<echo message=""/>
<echo message="gettools: download development tools for the build"/>
<echo message="realclean: remove all compiled and generated files"/>
<echo message="jar: make JFlex.jar"/>
<echo message=""/>
<echo message="Use the gettool target or override the *.jar properties"/>
<echo message="before you do the first build."/>
</target>
<target name="declare" description="define tasks for jflex and cup">
<taskdef classname="JFlex.anttask.JFlexTask" name="jflex" classpath="${jflex.jar}"/>
<taskdef classname="java_cup.anttask.CUPTask" name="cup" classpath="${cup.jar}"/>
</target>
<target name="gettools" description="download development tools">
<mkdir dir="${tools.dir}"/>
<get src="${jflex.jar.url}" dest="${jflex.jar}"/>
<get src="${cup.jar.url}" dest="${cup.jar}"/>
<get src="${junit.jar.url}" dest="${junit.jar}"/>
</target>
<target name="dist" description="build distribution">
<antcall target="gettools" />
<antcall target="build" />
<antcall target="libclean" />
</target>
<target name="build" depends="realclean,jar"
description="complete build from scratch"/>
<target name="cbuild" depends="libclean,compile,jar"
description="recompile and pack all classes"/>
<target name="compile" depends="jflex,cup"
description="compile all classes">
<javac srcdir="."
destdir="../lib"
target="1.1"
source="1.2"
classpath=".:${junit.jar}"
debug="on" />
</target>
<target name="jflex" depends="declare" description="generate scanner">
<jflex file="JFlex/LexScan.flex" skeleton="skeleton.nested"/>
</target>
<target name="cup" depends="declare" description="generate parser">
<cup srcfile="JFlex/LexParse.cup" interface="true" parser="LexParse" />
</target>
<target name="copy" description="copy resources to build dir">
<copy file="skeleton.default" todir="../lib/JFlex" />
<copy file="JFlex/Messages.properties" todir="../lib/JFlex/" />
</target>
<target name="jar" depends="compile,copy" description="make JFlex.jar">
<jar basedir="../lib"
includes="JFlex/**,java_cup/**,skeleton"
jarfile="../lib/JFlex.jar"
manifest="manifest"/>
</target>
<target name="libclean" description="remove compiled classes">
<delete dir="../lib/JFlex" />
<delete dir="../lib/java_cup" />
</target>
<target name="jarclean" description="remove JFlex.jar">
<delete file="../lib/JFlex.jar" />
</target>
<target name="genclean" description="remove genrated classes">
<delete file="JFlex/LexScan.java" />
<delete file="JFlex/LexParse.java" />
<delete file="JFlex/sym.java" />
</target>
<target name="clean" description="remove backup files">
<delete> <fileset dir="." includes="**/*~"/> </delete>
</target>
<target name="realclean" depends="clean,genclean,libclean,jarclean"
description="clean up extra tidily"/>
</project>