5051f0c429fe34d054c01fa43a53db0a2bf46d26
[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/'>
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/xwt/plat/${subplat}.java'/>
42                 <include name='org/bouncycastle/**/*.java'/>
43                 <include name='org/mozilla/**/*.java'/>
44                 <exclude name='org/xwt/Trap.java'/>
45             </fileset>
46             <mapper type='glob' from='*.java' to='*.o'/>
47         </apply>
48
49         <!-- we have to turn off optimization here due to a compiler bug -->
50         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}'>
51             <arg value='-fCLASSPATH=bin/'/>
52             <arg value='-O0'/>
53             <arg value='-ffast-math'/>
54             <arg value='-fomit-frame-pointer'/>
55             <arg value='-foptimize-sibling-calls'/>
56             <arg value='-finline-functions'/>
57             <arg value='-funroll-loops'/>
58             <arg value='-g'/>
59             <arg value='-c'/>
60             <srcfile/>
61             <arg value='-o'/>
62             <targetfile/>
63             <fileset dir='src/'>
64                 <include name='org/xwt/Trap.java'/>
65             </fileset>
66             <mapper type='glob' from='*.java' to='*.o'/>
67         </apply>
68
69         <echo message='compiling     .cc -> .o'/>
70         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}/'>
71             <arg value='-g'/>
72             <arg value='-Ibin-${plat}'/>
73             <arg value='-c'/>
74             <srcfile/>
75             <arg value='-o'/>
76             <targetfile/>
77             <fileset dir='src/' includes='org/xwt/plat/${subplat}.cc'/>
78             <mapper type='glob' from='*.cc' to='*-nat.o'/>
79         </apply>
80                                                                               
81         <echo message='wrapping    .xwar -> .o'/>
82         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}/'>
83             <fileset dir='bin/' includes='**/*.xwar'/>
84             <arg value='--resource'/>
85             <arg value='org/xwt/builtin.xwar'/>
86             <arg value='-c'/>
87             <srcfile/>
88             <arg value='-o'/>
89             <targetfile/>
90             <mapper type='glob' from='*.xwar' to='*.o'/>
91         </apply>
92
93         <echo message='linking        .o -> ${binaryname}'/>
94         <uptodate property="linked" targetfile="bin-${plat}/${binaryname}">
95             <srcfiles dir="bin-${plat}/" includes="**/*.o" excludes='*.o'/>
96         </uptodate>
97         <antcall target="link"/>
98
99     </target>
100
101     <target name="link" unless="linked">
102         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' parallel='true'>
103             <fileset dir='bin-${plat}/' includes='**/*.o' excludes='*.o'/>
104             <arg value='-fCLASSPATH=${gcc-path}/share/libgcj.jar'/>
105             <arg value='--main=org.xwt.Main'/>
106             <arg line='-o bin-${plat}/${binaryname}'/>
107             <srcfile/>
108             <arg line='-L${gcc-path}/lib ${linkflags}'/>
109        </apply>
110     </target>
111
112 </project>
113
114