2008-04-19 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / Mono.Cecil / default.build
1 <?xml version="1.0"?>
2 <project name="Cecil" default="cecil" basedir=".">
3
4         <property name="debug" value="false" />
5         <property name="optimize" value="true" />
6         <property name="build.dir" value="${path::get-full-path('bin')}" />
7         <property name="keyfile" value="../mono.snk" />
8         <property name="csc.defines" value="NO_DEFINE" />
9
10         <!-- allow properties to be customized in external file" -->
11         <include buildfile="build.properties" if="${file::exists('build.properties')}" />
12
13         <fileset id="all-files">
14                 <include name="./**/*.cs" />
15                 <exclude name="CodeGen/**/*.*" />
16         </fileset>
17
18         <target name="clean">
19                 <delete failonerror="false">
20                         <fileset>
21                                 <include name="**/bin/**" />
22                                 <include name="**/obj/**" />
23                                 <include name="${build.dir}/**" />
24                         </fileset>
25                 </delete>
26         </target>
27
28         <target name="init">
29                 <mkdir dir="${build.dir}" />
30         </target>
31
32         <target name="cecil" depends="init">
33                 <csc output="${build.dir}/Mono.Cecil.dll"
34                         target="library" debug="${debug}"
35                         unsafe="false" optimize="${optimize}"
36                         keyfile="${keyfile}"
37                         define="${csc.defines}">
38                         <sources refid="all-files"/>
39                 </csc>
40         </target>
41
42         <target name="compactframework" depends="init" description="compiles cecil to run on the CompactFramework 1.0">
43                 <property name="compactframework.defines" value="CF_1_0;${csc.defines}" />
44                 <property name="compactframework.dir" value="${compactframework.v1.dir}" />
45                 <call target="compactframework-compilation" />
46         </target>
47
48         <target name="compactframework2" depends="init" description="compiles cecil to run on the CompactFramework 2.0">
49                 <property name="compactframework.defines" value="CF_2_0;${csc.defines}" />
50                 <property name="compactframework.dir" value="${compactframework.v2.dir}" />
51                 <call target="compactframework-compilation" />
52         </target>
53
54         <target name="compactframework-compilation">
55                 <property name="temp.dir" value="${path::combine(path::get-temp-path(), 'cecil')}" />
56                 <delete dir="${temp.dir}" if="${directory::exists(temp.dir)}" />
57                 <mkdir dir="${temp.dir}" />
58
59                 <property name="framework.dir" value="${framework::get-framework-directory(framework::get-target-framework())}" />
60                 <property name="csc.exe" value="${path::combine(framework.dir, 'csc.exe')}" />
61
62                 <copy todir="${temp.dir}">
63                         <fileset refid="all-files" />
64                 </copy>
65
66                 <exec program="${csc.exe}" workingdir="${temp.dir}" failonerror="true">
67                         <arg value="/optimize" />
68                         <arg value="/debug-" />
69                         <arg value="/define:${compactframework.defines}" />
70                         <arg value="/out:${build.dir}/Mono.Cecil.dll" />
71                         <arg value="/target:library" />
72                         <arg value="/warn:0" />
73                         <arg value="/noconfig" />
74                         <arg value="/nostdlib+" />
75                         <arg value="/reference:${compactframework.dir}/mscorlib.dll" />
76                         <arg value="/reference:${compactframework.dir}/System.dll" />
77                         <arg value="/recurse:*.cs" />
78                 </exec>
79         </target>
80
81         <target name="codegen">
82                 <exec program="ruby" commandline="cecil-gen.rb" workingdir="CodeGen" />
83         </target>
84 </project>