gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
mjc2wsl, load the string names of the opcodes when displaying original code in comments
[mjc2wsl.git] / build.xml
1 <project name="mjc2wsl" default="all">
2 <property file="custom.properties"/>
4 <condition property="fermat.dir" value="C:\fermat3">
5 <os family="windows" />
6 </condition>
8 <condition property="fermat.dir" value="${user.home}/fermat3">
9 <not><os family="windows" /></not>
10 </condition>
13 <property name="java.encoding" value="utf-8" />
14 <taskdef resource="net/sf/antcontrib/antlib.xml"/>
16 <property name="mjc2wsl.class.dir" value="bin" />
17 <property name="mjc2wsl.src.dir" value="src" />
18 <property name="mjc2wsl.options" value="" />
20 <property name="compiler.class.dir" value="compiler-bin" />
21 <property name="compiler.src.dir" value="compiler" />
23 <property name="samples.main.dir" value="samples" />
24 <property name="samples.temp.dir" value="samples-temp" />
26 <property name="transf.wsl.file" value="src-wsl/transf-min.wsl" />
27 <property name="transf.wsl.ini" value="transf.ini" />
29 <description>
30 Builder script for mjc2wsl and related tools, runs test
31 on given samples.
33 Also gives options to chain the tools on individual files.
34 </description>
36 <target name="init">
37 <mkdir dir="${mjc2wsl.class.dir}"/>
38 <mkdir dir="${compiler.class.dir}"/>
39 <mkdir dir="${samples.temp.dir}"/>
40 <copy todir="${samples.temp.dir}">
41 <fileset dir="${samples.main.dir}">
42 <include name="*.mj"/>
43 </fileset>
44 </copy>
45 </target>
47 <target name="build" depends="init" description="build the mjc2wsl tool">
48 <javac srcdir="${mjc2wsl.src.dir}" destdir="${mjc2wsl.class.dir}" includeAntRuntime='no' />
49 </target>
51 <target name="mj-build" depends="init" description="build the mj compiler">
52 <javac srcdir="${compiler.src.dir}" destdir="${compiler.class.dir}" includeAntRuntime='no' />
53 </target>
55 <target name="mj-compile">
56 <echo message="${filename}" />
57 <java classpath="${compiler.class.dir}" classname="Compiler">
58 <arg value="${filename}" />
59 </java>
60 </target>
62 <target name="mj-samples" depends="mj-build" description="run the mj compiler on the samples">
63 <foreach param="filename" target="mj-compile">
64 <path>
65 <fileset dir='${samples.temp.dir}'>
66 <include name="*.mj"/>
67 </fileset>
68 </path>
69 </foreach>
70 </target>
72 <target name="mj-samples1" depends="mj-build">
73 <!-- simplistic version when antlib (foreach) is not available -->
74 <antcall target="mj-compile">
75 <param name="filename" value="samples-temp/sample.mj" />
76 </antcall>
77 <antcall target="mj-compile">
78 <param name="filename" value="samples-temp/sample1.mj" />
79 </antcall>
80 <antcall target="mj-compile">
81 <param name="filename" value="samples-temp/sample0.mj" />
82 </antcall>
83 </target>
85 <target name="mjc2wsl">
86 <echo message="${filename}" />
87 <java classpath="${mjc2wsl.class.dir}" classname="mjc2wsl">
88 <arg line="${mjc2wsl.options}" />
89 <arg value="${filename}" />
90 </java>
91 </target>
93 <target name="mjc2wsl-samples" depends="build" description="run the mjc2wsl tool on the samples">
94 <foreach param="filename" target="mjc2wsl">
95 <path>
96 <fileset dir='${samples.temp.dir}'>
97 <include name="*.obj"/>
98 </fileset>
99 </path>
100 </foreach>
101 </target>
103 <target name="mjc2wsl-samples1" depends="build">
104 <!-- simplistic version when antlib (foreach) is not available -->
105 <antcall target="mjc2wsl">
106 <param name="filename" value="samples-temp/sample0.obj" />
107 </antcall>
108 </target>
110 <target name="wsl-run" >
111 <exec executable="${fermat.dir}/bin/wsl" inputstring="${inputstring}">
112 <env key="PATH" path="${env.PATH}:${fermat.dir}/bin"/>
113 <env key="FermaT" path="${fermat.dir}" />
114 <env key="SCHEME_LIBRARY_PATH" path="${fermat.dir}/slib/" />
115 <env key="SCM_INIT_PATH" path="${fermat.dir}/scm/Init5e5.scm" />
116 <arg value="${filename}"/>
117 </exec>
118 </target>
120 <target name="wsl-transf"
121 description="transform (simplify) a single wsl file generated by mjc2wsl">
122 <delete file="${transf.wsl.ini}"/>
124 <antcall target="wsl-run">
125 <param name="filename" value="${transf.wsl.file}" />
126 <param name="inputstring" value="${transf.filename}" />
127 </antcall>
128 </target>
130 <target name="wsl-transf-samples" depends="make-transf-ini-samples"
131 description="transform (simplify) the wsl files generated by mjc2wsl">
132 <antcall target="wsl-run">
133 <param name="filename" value="${transf.wsl.file}" />
134 </antcall>
135 </target>
137 <target name="make-transf-ini-samples">
138 <fileset dir="${samples.temp.dir}" casesensitive="no" id="generated-wsl-fileset">
139 <patternset id="non.transformed.sources">
140 <include name="**/*.wsl"/>
141 <exclude name="**/*_t.wsl"/>
142 </patternset>
143 </fileset>
144 <pathconvert pathsep="${line.separator}"
145 property="generated-wsl-files" refid="generated-wsl-fileset" />
147 <echo file="${transf.wsl.ini}">${generated-wsl-files}</echo>
148 </target>
150 <target name="all" depends='mj-samples,mjc2wsl-samples,wsl-transf-samples'
151 description="build the tools, run them on the samples to check">
153 </target>
155 <target name="clean" description="clean up all the generated content">
156 <delete includeemptydirs="true">
157 <fileset dir=".">
158 <include name="${mjc2wsl.class.dir}/*.class"/>
159 <include name="${compiler.class.dir}/*.class"/>
160 <include name="${samples.temp.dir}/*"/>
161 </fileset>
162 <dirset dir=".">
163 <include name="${mjc2wsl.class.dir}"/>
164 <include name="${compiler.class.dir}"/>
165 <include name="${samples.temp.dir}"/>
166 </dirset>
167 </delete>
168 </target>
170 <!-- jedit specific flags; needs to be the first or the last 10 lines
171 :noTabs=true:
172 -->
173 </project>
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner