Added separate cc/ci emitters, modified driver, added antlr3.1 option
[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.3.0">\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     <path id="project.class.path.3.1">\r
31         <pathelement location="lib/antlr-2.7.7.jar"/>\r
32         <pathelement location="lib/antlr-3.1b1.jar"/>\r
33         <pathelement location="lib/antlr-runtime-3.1b1.jar"/>\r
34         <pathelement location="lib/stringtemplate-3.1.jar"/>\r
35         <pathelement location="lib/gunit-1.0.2.jar"/>\r
36     </path>\r
37     <property name="classpath" value="project.class.path.3.1"/>\r
38 \r
39     <!-- antlr options -->\r
40     <property name="profile" value="false" />\r
41     <property name="report" value="false" />\r
42     <property name="multithreaded" value="true" />\r
43     <property name="depend" value="true" />\r
44 \r
45     <target name="init">\r
46         <tstamp />\r
47         <!-- Create the build directory structure used by compile -->\r
48         <copy todir="${buildsrc}">\r
49             <fileset dir="${src}"/>\r
50         </copy>\r
51         <mkdir dir="${classes}" />\r
52         <mkdir dir="${classes}/META-INF" />\r
53         <mkdir dir="${buildlib}" />\r
54         <mkdir dir="${doc}" />\r
55     </target>\r
56 \r
57     <macrodef name="antlr3">\r
58         <attribute name="grammar.name"/>\r
59         <attribute name="grammar.path"/>\r
60         <sequential>\r
61             <echo message="antlr @{grammar.name}" />\r
62             <antlr:antlr3 xmlns:antlr="antlib:org/apache/tools/ant/antlr" \r
63                 target="@{grammar.path}/@{grammar.name}" \r
64                 outputdirectory="@{grammar.path}"\r
65                 libdirectory="@{grammar.path}"\r
66                 multithreaded="${multithreaded}"\r
67                 report="${report}"\r
68                 depend="${depend}"\r
69                 profile="${profile}">\r
70                 <classpath refid="${classpath}"/>\r
71             </antlr:antlr3>\r
72         </sequential>\r
73     </macrodef>\r
74     \r
75     <target name="Charj" depends="init">\r
76         <antlr3 grammar.name="Charj.g" \r
77             grammar.path="${buildsrc}/charj/translator"/>\r
78     </target>\r
79 \r
80     <target name="CharjEmitter" depends="Charj">\r
81         <antlr3 grammar.name="CharjCCEmitter.g" \r
82             grammar.path="${buildsrc}/charj/translator"/>\r
83         <antlr3 grammar.name="CharjCIEmitter.g" \r
84             grammar.path="${buildsrc}/charj/translator"/>\r
85     </target>\r
86 \r
87     <target name="compile" depends="Charj, CharjEmitter" description="compile">\r
88         <javac debug="true" srcdir="${buildsrc}" destdir="${classes}"\r
89                target="1.5" listfiles="Yes" deprecation="Yes">\r
90                <classpath refid="${classpath}"/>\r
91         </javac>\r
92     </target>\r
93 \r
94     <target name="manifest">\r
95         <manifest file="${classes}/META-INF/MANIFEST.MF">\r
96             <attribute name="Main-Class" value="charj.Main" />\r
97         </manifest>\r
98     </target>\r
99 \r
100     <target name="dist" depends="compile, manifest" \r
101        description="create jarfiles">\r
102        <jar jarfile="${buildlib}/charj.jar" basedir="${classes}"\r
103            manifest="${classes}/META-INF/MANIFEST.MF"/>\r
104     </target>\r
105 \r
106     <target name="doc" description="generate documentation">\r
107        <javadoc destdir="${doc}"\r
108                 author="true"\r
109                 version="true"\r
110                 use="true"\r
111                 windowtitle="${project.name}"\r
112                 sourcepath="${src}"\r
113                 Protected="All" Private="All"\r
114                 Public="All"\r
115                 Locale="de"\r
116                 linksource="yes"\r
117                 breakiterator="Yes">\r
118        </javadoc>\r
119     </target>\r
120 \r
121     <target name="clean" description="clean up">\r
122        <delete>\r
123           <fileset dir="${buildsrc}" />\r
124           <fileset dir="${classes}" />\r
125           <fileset dir="${buildlib}" />\r
126           <fileset dir="${doc}" />\r
127        </delete>\r
128     </target>\r
129     \r
130     <target name="redo" depends="init">\r
131         <!--\r
132        <touch>\r
133          <fileset dir="${src}" includes="*.g"/>\r
134        </touch>\r
135        -->\r
136     </target>\r
137     \r
138     <target name="all" depends="clean, redo, dist, doc" \r
139         description="do all"/>\r
140             \r
141 </project>\r