2002/10/12 19:53:50
[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='-g'/>
28             <arg value='-c'/>
29             <srcfile/>
30             <arg value='-o'/>
31             <targetfile/>
32             <fileset dir='src/'>
33                 <include name='org/xwt/*.java'/>
34                 <include name='org/xwt/util/*.java'/>
35                 <include name='org/xwt/plat/GCJ.java'/>
36                 <include name='org/xwt/plat/${subplat}.java'/>
37                 <include name='org/bouncycastle/**/*.java'/>
38                 <include name='org/mozilla/**/*.java'/>
39                 <exclude name='org/xwt/Trap.java'/>
40             </fileset>
41             <mapper type='glob' from='*.java' to='*.o'/>
42         </apply>
43
44         <!-- we have to turn off optimization here due to a compiler bug -->
45         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}'>
46             <arg value='-fCLASSPATH=bin/'/>
47             <arg value='-O0'/>
48             <arg value='-g'/>
49             <arg value='-c'/>
50             <srcfile/>
51             <arg value='-o'/>
52             <targetfile/>
53             <fileset dir='src/'>
54                 <include name='org/xwt/Trap.java'/>
55             </fileset>
56             <mapper type='glob' from='*.java' to='*.o'/>
57         </apply>
58
59         <echo message='compiling     .cc -> .o'/>
60         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}/'>
61             <arg value='-g'/>
62             <arg value='-Ibin-${plat}'/>
63             <arg value='-c'/>
64             <srcfile/>
65             <arg value='-o'/>
66             <targetfile/>
67             <fileset dir='src/' includes='org/xwt/plat/${subplat}.cc'/>
68             <mapper type='glob' from='*.cc' to='*-nat.o'/>
69         </apply>
70                                                                               
71         <echo message='wrapping    .xwar -> .o'/>
72         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' dest='bin-${plat}/'>
73             <fileset dir='bin/' includes='**/*.xwar'/>
74             <arg value='--resource'/>
75             <arg value='org/xwt/builtin.xwar'/>
76             <arg value='-c'/>
77             <srcfile/>
78             <arg value='-o'/>
79             <targetfile/>
80             <mapper type='glob' from='*.xwar' to='*.o'/>
81         </apply>
82
83         <echo message='linking        .o -> ${binaryname}'/>
84         <uptodate property="linked" targetfile="bin-${plat}/${binaryname}">
85             <srcfiles dir="bin-${plat}/" includes="**/*.o" excludes='*.o'/>
86         </uptodate>
87         <antcall target="link"/>
88
89     </target>
90
91     <target name="link" unless="linked">
92         <apply failonerror='true' executable='${gcc-path}/bin/${gcc-target}gcj' parallel='true'>
93             <fileset dir='bin-${plat}/' includes='**/*.o' excludes='*.o'/>
94             <arg value='-fCLASSPATH=${gcc-path}/share/libgcj.jar'/>
95             <arg value='--main=org.xwt.Main'/>
96             <arg line='-o bin-${plat}/${binaryname}'/>
97             <srcfile/>
98             <arg line='${linkflags}'/>
99        </apply>
100     </target>
101
102 </project>
103
104