3d59c9c2c277e4bc4f091a64b7258c69c84560f7
[mirror_edk2.git] / Tools / CCode / Source / build.xml
1 <?xml version="1.0" encoding="utf-8" ?>
2 <!--
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 -->
12 <project default="all" basedir="." name="C_Code">
13 <!-- Copyright (c) 2006, Intel Corporation -->
14 <!-- Filename: Tools/Source/build.xml -->
15
16 <taskdef resource="net/sf/antcontrib/antlib.xml"/>
17
18 <property name="ReallyVerbose" value="false"/>
19 <property environment="env" />
20
21 <property name="WORKSPACE" value="${env.WORKSPACE}" />
22 <property name="WORKSPACE_DIR" value="${WORKSPACE}" />
23 <property name="PACKAGE" value="Tools" />
24 <property name="PACKAGE_DIR" value="${WORKSPACE}/Tools/Source/TianoTools" />
25 <property name="LIB_DIR" value="${PACKAGE_DIR}/Library" />
26 <property name="BIN_DIR" value="${WORKSPACE}/Tools/bin" />
27 <property name="BUILD_MODE" value="PACKAGE" />
28 <property name="Libs"
29 value="Common/build.xml CustomizedCompress/build.xml PeCoffLoader/build.xml String/build.xml"/>
30
31 <import file="${WORKSPACE_DIR}/Tools/Conf/BuildMacro.xml" />
32
33 <path id="classpath">
34 <fileset dir="${WORKSPACE}/Tools/Jars" includes="*.jar"/>
35 <fileset dir="${env.XMLBEANS_HOME}/lib" includes="*.jar"/>
36 </path>
37
38 <taskdef classpathref="classpath" resource="GenBuild.tasks" />
39 <taskdef classpathref="classpath" resource="net/sf/antcontrib/antlib.xml" />
40
41 <taskdef classpathref="classpath" resource="cpptasks.tasks"/>
42 <typedef classpathref="classpath" resource="cpptasks.types"/>
43
44 <target name="all" depends="init, Tools">
45 <echo message="The EDK II C Tools build complete!"/>
46 </target>
47
48 <target name="init">
49 <echo message="EDK C Code Tools, build initialization"/>
50 <mkdir dir="${BIN_DIR}" />
51 <mkdir dir="${LIB_DIR}" />
52
53 <condition property="HostArch" value="X64">
54 <os arch="amd64"/>
55 </condition>
56 <condition property="HostArch" value="Ia32">
57 <or>
58 <os arch="x86"/>
59 <os arch="i386"/>
60 </or>
61 </condition>
62 <condition property="HostArch" value="Ia32">
63 <os arch="i386"/>
64 </condition>
65
66 <if>
67 <os family="unix" />
68 <then>
69 <echo message="OS Family UNIX, ${HostArch}" />
70 </then>
71 <elseif>
72 <os family="dos" />
73 <then>
74 <echo message="OS Family DOS, ${HostArch}" />
75 </then>
76 </elseif>
77 <elseif>
78 <os family="mac" />
79 <then>
80 <echo message="OS Family OS X, ${HostArch}" />
81 </then>
82 </elseif>
83 <else>
84 <fail message="OS Family Unsupported, ${HostArch}" />
85 </else>
86 </if>
87
88 <if>
89 <not>
90 <isset property="ToolChain" />
91 </not>
92 <then>
93 <if>
94 <isset property="env.TOOL_CHAIN" />
95 <then>
96 <property name="ToolChain" value="${env.TOOL_CHAIN}"/>
97 </then>
98 <else>
99 <!-- Default Tool Chain is Microsoft Visual Studio -->
100 <property name="ToolChain" value="msvc"/>
101 </else>
102 </if>
103 </then>
104 </if>
105
106 <if>
107 <equals arg1="${ToolChain}" arg2="gcc" />
108 <then>
109 <exec executable="gcc" outputproperty="host.gcc.ver">
110 <arg line="-E" />
111 <arg line="-P" />
112 <arg line="-x c" />
113 <arg line="gcc.ver" />
114 </exec>
115 <if>
116 <contains string="${host.gcc.ver}" substring="4" />
117 <then>
118 <property name="ExtraArgus" value="-Wno-pointer-sign" />
119 </then>
120 </if>
121 </then>
122 </if>
123
124 <condition property="linux" value="true">
125 <os name="Linux"/>
126 </condition>
127
128 <condition property="intel_win">
129 <and>
130 <os family="dos"/>
131 <equals arg1="${ToolChain}" arg2="intel"/>
132 </and>
133 </condition>
134
135 <condition property="intel_linux">
136 <and>
137 <os name="Linux"/>
138 <equals arg1="${ToolChain}" arg2="intel"/>
139 </and>
140 </condition>
141
142 <condition property="intel_mac">
143 <and>
144 <os family="mac"/>
145 <equals arg1="${ToolChain}" arg2="intel"/>
146 </and>
147 </condition>
148
149 <condition property="gcc">
150 <and>
151 <equals arg1="${ToolChain}" arg2="gcc"/>
152 </and>
153 </condition>
154
155 <condition property="cygwin">
156 <and>
157 <os family="dos"/>
158 <equals arg1="${ToolChain}" arg2="gcc"/>
159 </and>
160 </condition>
161
162 <condition property="x86_64_linux">
163 <and>
164 <os name="Linux"/>
165 <equals arg1="${HostArch}" arg2="X64"/>
166 </and>
167 </condition>
168
169 <condition property="windows" value="true">
170 <os family="Windows"/>
171 </condition>
172
173 <condition property="OSX" value="true">
174 <os family="Mac"/>
175 </condition>
176
177 <condition property="cyglinux">
178 <or>
179 <istrue value="${linux}"/>
180 <istrue value="${cygwin}"/>
181 </or>
182 </condition>
183
184 <!-- msft is a family, used by both Microsoft and Intel Windows compiler tool chains -->
185 <condition property="msft">
186 <isfalse value="${gcc}"/>
187 </condition>
188
189 <if>
190 <istrue value="${ReallyVerbose}"/>
191 <then>
192 <echo message="Test property msvc: ${msvc}"/>
193 <echo message="Test property gcc: ${gcc}"/>
194 <echo message="Test property intel_win: ${intel_win}"/>
195 <echo message="Test property intel_linux: ${intel_linux}"/>
196 <echo message="Test property intel_mac: ${intel_mac}"/>
197 <echo message="Test property msft: ${msft}"/>
198 <echo message="Test property cygwin: ${cygwin}"/>
199 <echo message="Test property cyglinux: ${cyglinux}"/>
200 <echo message="Test property windows: ${windows}"/>
201 <echo message="Test property linux: ${linux}"/>
202 <echo message="Test property OSX: ${OSX}"/>
203 <echo message="Test property x86_64_linux: ${x86_64_linux}"/>
204 </then>
205 </if>
206
207 <property name="haveLibtool" value="false"/>
208 <if>
209 <and>
210 <not>
211 <isset property="env.CYGWIN_HOME"/>
212 </not>
213 <isset property="cygwin"/>
214 </and>
215 <then>
216 <fail message="You must set the environment variable: CYGWIN_HOME"/>
217 </then>
218 </if>
219
220 <if>
221 <istrue value="${gcc}"/>
222 <then>
223 <property name="ext_static" value=".a"/>
224 <property name="ext_dynamic" value=".so"/>
225 <if>
226 <istrue value="${cygwin}"/>
227 <then>
228 <property name="ext_exe" value=".exe"/>
229 </then>
230 <else>
231 <property name="ext_exe" value=""/>
232 </else>
233 </if>
234 </then>
235 <else>
236 <property name="ext_static" value=".lib"/>
237 <property name="ext_dynamic" value=".dll"/>
238 <property name="ext_exe" value=".exe"/>
239 </else>
240 </if>
241 </target>
242
243 <target name="Libraries" depends="init">
244 <subant target="" inheritall="true">
245 <fileset dir="${PACKAGE_DIR}"
246 includes="${Libs}"/>
247 </subant>
248 </target>
249
250 <target name="Tools" depends="Libraries">
251 <subant target="" inheritall="true">
252 <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"
253 excludes="${Libs}"/>
254 </subant>
255 </target>
256
257 <target name="clean" depends="init">
258 <subant target="clean" inheritall="true">
259 <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
260 </subant>
261 </target>
262
263 <target name="cleanall" depends="init">
264 <subant target="cleanall" inheritall="true">
265 <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
266 </subant>
267 <delete dir="${LIB_DIR}"/>
268 </target>
269 </project>