-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.xml
More file actions
297 lines (241 loc) · 11.5 KB
/
build.xml
File metadata and controls
297 lines (241 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
<!-- ===========================================================================
Installing the build tools
==========================
The Jasmin build system is based on Jakarta Ant, which is a Java building tool
originally developed for the Jakarta Tomcat project but now used in many other
Apache projects and extended by many developers.
Ant is a little but very handy tool that uses a build file written in XML
(this file) as building instructions. For more information refer to
"http://jakarta.apache.org/ant/".
Jasmin includes its own copy of the ant library in the lib directory.
The only other thing that you have to make sure of is that the
"JAVA_HOME" environment property is set to match the top level directory
containing the JVM you want to use. For example:
C:\> set JAVA_HOME=C:\jdk1.4
or on Unix:
% setenv JAVA_HOME /usr/local/java
(csh)
> JAVA_HOME=/usr/java; export JAVA_HOME
(ksh, bash)
That's it!
Building instructions
=====================
First, make sure your current working directory is
where this very file is located. Then type:
./build.sh all (unix)
build.bat all (win32)
To build the framework, examples, and tests or:
./build.sh (unix)
build.bat (win32)
To list all the possible build targets.
If everything is right (see *) and all the required packages are visible, this action
will generate a build directory ./build, containing the jar file:
jasmin.jar - This jar contains the Jasmin assembler
This jar file can be run by the command
java -jar jasmin.jar <filenames>
from within the ./build directory.
* On Win/98 you may get an "Out of Environment Space" error message. This happens if
Windows provides too small a space for environment variables. To work around this
limitation:
Close the DOS window (the error can corrupt its CLASSPATH variable).
Open a new DOS window. Click on the MS-DOS icon at the top left of the window.
Select the Properties option.
Click on the Memory tab.
Adjust the "Initial Environment" drop-down box from "Auto" to "2816".
Click OK.
Then try building.
-->
<project name="Jasmin" default="usage" basedir=".">
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<property name="Name" value="Jasmin"/>
<property name="name" value="jasmin"/>
<property name="version" value="2.1"/>
<property name="year" value="2006"/>
<echo message="----------- ${Name} ${version} [${year}] ------------"/>
<property name="build.compiler" value="modern"/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
<property name="deprecation" value="on"/>
<property name="packages" value="jasmin.*,jas.*,scm.*"/>
<!-- Define the source directories -->
<property name="root.dir" value="./"/>
<property name="docs.dir" value="${root.dir}/docs"/>
<property name="lib.dir" value="${root.dir}/lib"/>
<property name="src.dir" value="${root.dir}/src"/>
<!-- Define the source build directories -->
<property name="build.dir" value="${root.dir}/build"/>
<property name="build.lib" value="${build.dir}/lib"/>
<property name="build.jasmin.src" value="${build.dir}/jasmin/src"/>
<property name="build.jasmin.dest" value="${build.dir}/jasmin/classes"/>
<property name="apidocs.dir" value="${docs.dir}/api"/>
<!-- Define the distribution directories -->
<property name="dist.root" value="${root.dir}/dist"/>
<property name="sourcedist.dir" value="${dist.root}/${name}-${version}/${name}-${version}"/>
<property name="compiledist.dir" value="${dist.root}/${name}-${version}/${name}-${version}"/>
</target>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="Jasmin Build file"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" all --> builds all the jars in ./build"/>
<echo message=" parser --> regenerates parser.java from parser.cup "/>
<echo message=" docs --> builds the documentation in ./docs/api"/>
<echo message=" clean --> restores distribution to original state"/>
<echo message=" sourcedist --> builds and zips the source distribution"/>
<echo message=" usage --> (default) displays build menu"/>
<echo message=""/>
<echo message=" See the comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.lib}"/>
<copy todir="${build.lib}">
<fileset dir="${lib.dir}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Prepares the jasmin source code -->
<!-- =================================================================== -->
<target name="prepare-jasmin" depends="prepare">
<mkdir dir="${build.jasmin.src}"/>
<mkdir dir="${build.jasmin.dest}"/>
<copy todir="${build.jasmin.src}">
<fileset dir="${src.dir}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Compiles the jasmin source code -->
<!-- =================================================================== -->
<target name="compile-jasmin" depends="prepare-jasmin">
<javac srcdir="${build.jasmin.src}"
source="1.4"
destdir="${build.jasmin.dest}"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"/>
</target>
<!-- =================================================================== -->
<!-- Creates the jasmin.jar in ./build -->
<!-- =================================================================== -->
<target name="jasmin" depends="compile-jasmin">
<jar jarfile="${root.dir}/${name}.jar"
basedir="${build.jasmin.dest}"
manifest="${build.jasmin.src}/jasmin.mf"
includes="jasmin/*.class,jas/*.class,java_cup/runtime/*.class"/>
</target>
<!-- =================================================================== -->
<!-- Compiles the JavaCup library -->
<!-- =================================================================== -->
<target name="compile-java_cup" depends="prepare-jasmin">
<mkdir dir="${build.jasmin.dest}/java_cup"/>
<javac srcdir="${build.jasmin.src}/java_cup"
source="1.4"
destdir="${build.jasmin.dest}/java_cup"
debug="${debug}"
deprecation="${deprecation}"
optimize="${optimize}"/>
</target>
<target name="java_cup" depends="compile-java_cup">
<jar jarfile="${root.dir}/lib/java_cup.jar"
basedir="${build.jasmin.dest}"
includes="java_cup/*.class,java_cup/runtime/*.class"/>
</target>
<!--
This task runs Java Cup to generate the Jasmin Parser (parser.java)
from the CUP file (parser.cup) in the Jasmin src directory. You only need to
run this task if you edit parser.cup.
-->
<target name="parser" depends="java_cup">
<java classname="java_cup.Main" output="test.java" input="src/jasmin/parser.cup">
<classpath>
<pathelement location="${root.dir}/lib/java_cup.jar"/>
</classpath>
</java>
<move file="parser.java" tofile="src/jasmin/parser.java"/>
<move file="sym.java" tofile="src/jasmin/sym.java"/>
</target>
<!-- =================================================================== -->
<!-- Build all jars in ./build -->
<!-- =================================================================== -->
<target name="all" depends="jasmin,docs"/>
<!-- =================================================================== -->
<!-- Creates the API documentation in ./docs/api/ -->
<!-- =================================================================== -->
<target name="docs">
<mkdir dir="${apidocs.dir}"/>
<javadoc packagenames="${packages}"
link="http://java.sun.com/j2se/1.4/docs/api"
sourcepath="${src.dir}"
destdir="${apidocs.dir}"
author="true"
additionalparam="-source 1.4"
version="true"
use="true"
splitindex="true"
noindex="false"
windowtitle="${Name} API"
doctitle="${Name}"
bottom="Copyright © ${year} Jonathan Meyer, USA All rights reserved."
/>
</target>
<!-- =================================================================== -->
<!-- Build source distribution in ./dist -->
<!-- =================================================================== -->
<target name="sourcedist" depends="clean">
<mkdir dir="${dist.root}"/>
<mkdir dir="${sourcedist.dir}"/>
<copy todir="${sourcedist.dir}">
<fileset dir="${root.dir}"/>
</copy>
<!-- Now delete what we dont want, probably a better way to do this -->
<delete dir="${sourcedist.dir}/dist"/>
<delete dir="${sourcedist.dir}/classes"/>
<zip zipfile="${dist.root}/${name}-${version}.zip"
basedir="${dist.root}/${name}-${version}"
whenempty="create"
/>
</target>
<!-- =================================================================== -->
<!-- Build compiled distribution in ./dist -->
<!-- =================================================================== -->
<target name="compiledist" depends="clean, all">
<mkdir dir="${dist.root}"/>
<mkdir dir="${compiledist.dir}"/>
<copy todir="${compiledist.dir}">
<fileset dir="${root.dir}"/>
</copy>
<!-- Now delete what we dont want, probably a better way to do this -->
<delete dir="${compiledist.dir}/dist"/>
<delete dir="${compiledist.dir}/build"/>
<zip zipfile="${dist.root}/${name}-${version}.zip"
basedir="${dist.root}/${name}-${version}"
whenempty="create"
/>
</target>
<!-- =================================================================== -->
<!-- Clean restores distribution to original state -->
<!-- =================================================================== -->
<target name="clean" depends="init">
<delete dir="${build.dir}"/>
<delete dir="${dist.root}"/>
<delete dir="${apidocs.dir}"/>
</target>
</project>
<!-- End of file -->