2003/02/15 11:43:08
[org.ibex.core.git] / src / org / xwt / plat / GCJ.xml
1 <!-- Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL] -->
2 <!--
3
4     Subclasses of org.xwt.plat.GCJ should include a .xml file which
5     sets the following properties, then invokes <ant antfile="src/org/xwt/plat/GCJ.xml"/>
6
7         gcc-target    - the gcc target name to use (for example, i686-pc-mingw32)
8         linkflags     - extra flags to pass to gcj during the link phase, if any
9         binaryname    - the name to give to the final binary
10
11 -->
12
13 <project name="GCJ" default="build">
14
15     <target name="build">
16
17         <echo message='extracting .class -> .h'/>
18         <taskdef name='gcjh' classname='org.xwt.tasks.GCJHTask'>
19             <classpath path='bin/'/>                                                                               
20         </taskdef>
21         <gcjh out='bin-${plat}' classpath='bin'/>
22
23         <echo message='compiling   .java -> .o'/>
24         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}'>
25             <arg value='-fCLASSPATH=bin/'/>
26             <arg value='-O9'/>
27             <arg value='-ffast-math'/>
28             <arg value='-fomit-frame-pointer'/>
29             <arg value='-foptimize-sibling-calls'/>
30             <arg value='-finline-functions'/>
31             <arg value='-funroll-loops'/>
32             <arg value='-g'/>
33             <arg value='-c'/>
34             <srcfile/>
35             <arg value='-o'/>
36             <targetfile/>
37             <fileset dir='src/' includes='${javafiles}'>
38                 <include name='org/xwt/*.java'/>
39                 <include name='org/xwt/util/*.java'/>
40                 <include name='org/xwt/plat/GCJ.java'/>
41                 <include name='org/bouncycastle/**/*.java'/>
42                 <include name='org/mozilla/**/*.java'/>
43                 <exclude name='org/xwt/Trap.java'/>
44             </fileset>
45             <mapper type='glob' from='*.java' to='*.o'/>
46         </apply>
47
48         <!-- we have to turn off optimization here due to a compiler bug -->
49         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}'>
50             <arg value='-fCLASSPATH=bin/'/>
51             <arg value='-O0'/>
52             <arg value='-ffast-math'/>
53             <arg value='-fomit-frame-pointer'/>
54             <arg value='-foptimize-sibling-calls'/>
55             <arg value='-finline-functions'/>
56             <arg value='-funroll-loops'/>
57             <arg value='-g'/>
58             <arg value='-c'/>
59             <srcfile/>
60             <arg value='-o'/>
61             <targetfile/>
62             <fileset dir='src/'>
63                 <include name='org/xwt/Trap.java'/>
64             </fileset>
65             <mapper type='glob' from='*.java' to='*.o'/>
66         </apply>
67
68         <echo message='compiling     .cc -> .o'/>
69         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}/'>
70             <arg value='-g'/>
71             <arg value='-Ibin-${plat}'/>
72             <arg value='-c'/>
73             <srcfile/>
74             <arg value='-o'/>
75             <targetfile/>
76             <fileset dir='src/' includes='${ccfiles}'/>
77             <mapper type='glob' from='*.cc' to='*-nat.o'/>
78         </apply>
79                                                                               
80         <echo message='wrapping    .xwar -> .o'/>
81         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}/'>
82             <fileset dir='bin/' includes='**/*.xwar'/>
83             <arg value='--resource'/>
84             <arg value='org/xwt/builtin.xwar'/>
85             <arg value='-c'/>
86             <srcfile/>
87             <arg value='-o'/>
88             <targetfile/>
89             <mapper type='glob' from='*.xwar' to='*.o'/>
90         </apply>
91
92         <echo message='linking        .o -> ${binaryname}'/>
93         <uptodate property="linked" targetfile="bin-${plat}/${binaryname}">
94             <srcfiles dir="bin-${plat}/" includes="**/*.o" excludes='*.o'/>
95         </uptodate>
96         <antcall target="link"/>
97
98     </target>
99
100     <target name="link" unless="linked">
101         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' parallel='true'>
102             <fileset dir='bin-${plat}/' includes='**/*.o' excludes='*.o'/>
103             <arg value='-fCLASSPATH=${gcc-path}/share/libgcj.jar'/>
104             <arg value='--main=org.xwt.Main'/>
105             <arg line='-o bin-${plat}/${binaryname}'/>
106             <srcfile/>
107             <arg line='${linkflags}'/>
108        </apply>
109     </target>
110
111 </project>
112
113