b9f7a35b8f44a3375f9b9bde0ff5d4c6990d984d
[charm.git] / src / langs / charj / build.xml
1 <project name="Charj" default="dist" basedir=".">\r
2     <description>\r
3         A translator and standard library for Charj, a language based on the\r
4         Charm++ runtime system.\r
5     </description>\r
6     \r
7     <property name="project.name" value="Charj" />\r
8     \r
9     <!-- set global properties for this build -->\r
10     <property name="build" location="build"/>\r
11     <property name="src" location="src"/>\r
12     <property name="buildsrc" location="${build}/src"/>\r
13     <property name="buildlib" location="${build}/lib" />\r
14     <property name="classes" location="${build}/classes"/>\r
15     <property name="lib" location="lib" />\r
16     <property name="doc" location="docs"/>\r
17 \r
18     <property name="package" value="charj"/>\r
19     \r
20     <!-- where to write/find token files -->\r
21     <property name="token.lib" location="${buildsrc}/${package}" />\r
22 \r
23     <!-- Define path used for classpath later -->\r
24     <path id="project.class.path">\r
25         <pathelement location="lib/antlr-2.7.7.jar"/>\r
26         <pathelement location="lib/antlr-3.0.1.jar"/>\r
27         <pathelement location="lib/antlr-runtime-3.0.1.jar"/>\r
28         <pathelement location="lib/stringtemplate-3.1b1.jar"/>\r
29     </path>\r
30 \r
31     <!-- antlr options -->\r
32     <property name="profile" value="false" />\r
33     <property name="report" value="false" />\r
34     <property name="multithreaded" value="true" />\r
35     <property name="depend" value="true" />\r
36 \r
37     <target name="init">\r
38         <tstamp />\r
39         <!-- Create the build directory structure used by compile -->\r
40         <copy todir="${buildsrc}">\r
41             <fileset dir="${src}"/>\r
42         </copy>\r
43         <mkdir dir="${classes}" />\r
44         <mkdir dir="${classes}/META-INF" />\r
45         <mkdir dir="${buildlib}" />\r
46         <mkdir dir="${doc}" />\r
47     </target>\r
48 \r
49     <macrodef name="antlr3">\r
50         <attribute name="grammar.name"/>\r
51         <attribute name="grammar.path"/>\r
52         <sequential>\r
53             <echo message="antlr @{grammar.name}" />\r
54             <antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr" \r
55                 target="@{grammar.path}/@{grammar.name}" \r
56                 outputdirectory="@{grammar.path}"\r
57                 libdirectory="@{grammar.path}"\r
58                 multithreaded="${multithreaded}"\r
59                 report="${report}"\r
60                 depend="${depend}"\r
61                 profile="${profile}">\r
62                 <classpath refid="project.class.path"/>\r
63             </antlr:antlr3>\r
64         </sequential>\r
65     </macrodef>\r
66     \r
67     <target name="Charj" depends="init">\r
68         <antlr3 grammar.name="Charj.g" \r
69             grammar.path="${buildsrc}/charj/translator"/>\r
70     </target>\r
71 \r
72     <target name="CharjEmitter" depends="Charj">\r
73         <antlr3 grammar.name="CharjEmitter.g" \r
74             grammar.path="${buildsrc}/charj/translator"/>\r
75     </target>\r
76     \r
77     <target name="compile" depends="Charj, CharjEmitter" description="compile">\r
78         <javac debug="true" srcdir="${buildsrc}" destdir="${classes}"\r
79                target="1.5" listfiles="Yes" deprecation="Yes">\r
80             <classpath refid="project.class.path"/>\r
81         </javac>\r
82     </target>\r
83 \r
84     <target name="manifest">\r
85         <manifest file="${classes}/META-INF/MANIFEST.MF">\r
86             <attribute name="Main-Class" value="charj.Main" />\r
87         </manifest>\r
88     </target>\r
89 \r
90     <target name="dist" depends="compile, manifest" \r
91        description="create jarfiles">\r
92        <jar jarfile="${buildlib}/charj.jar" basedir="${classes}"\r
93            manifest="${classes}/META-INF/MANIFEST.MF"/>\r
94     </target>\r
95 \r
96     <target name="doc" description="generate documentation">\r
97        <javadoc destdir="${doc}"\r
98                 author="true"\r
99                 version="true"\r
100                 use="true"\r
101                 windowtitle="${project.name}"\r
102                 sourcepath="${src}"\r
103                 Protected="All" Private="All"\r
104                 Public="All"\r
105                 Locale="de"\r
106                 linksource="yes"\r
107                 breakiterator="Yes">\r
108        </javadoc>\r
109     </target>\r
110 \r
111     <target name="clean" description="clean up">\r
112        <delete>\r
113           <fileset dir="${buildsrc}" />\r
114           <fileset dir="${classes}" />\r
115           <fileset dir="${buildlib}" />\r
116           <fileset dir="${doc}" />\r
117        </delete>\r
118     </target>\r
119     \r
120     <target name="redo" depends="init">\r
121         <!--\r
122        <touch>\r
123          <fileset dir="${src}" includes="*.g"/>\r
124        </touch>\r
125        -->\r
126     </target>\r
127     \r
128     <target name="all" depends="clean, redo, dist, doc" \r
129         description="do all"/>\r
130             \r
131 </project>\r