Fix building issue for VC compiler. And enable GenFvMap in building CCode package.
[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/CCode/Source" />
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="net/sf/antcontrib/antlib.xml" />
39
40
41 <target name="all" depends="initArch, init, Tools">
42 <echo message="The EDK II C Tools build complete!"/>
43 </target>
44
45 <target name="init">
46 <echo message="EDK C Code Tools, build initialization"/>
47 <taskdef classpathref="classpath" resource="GenBuild.tasks" />
48 <taskdef classpathref="classpath" resource="cpptasks.tasks"/>
49 <typedef classpathref="classpath" resource="cpptasks.types"/>
50 <mkdir dir="${BIN_DIR}" />
51 <mkdir dir="${LIB_DIR}" />
52
53 </target>
54
55 <target name="initArch">
56 <condition property="HostArch" value="X64">
57 <os arch="amd64"/>
58 </condition>
59 <condition property="HostArch" value="Ia32">
60 <or>
61 <os arch="x86"/>
62 <os arch="i386"/>
63 </or>
64 </condition>
65 <condition property="HostArch" value="Ia32">
66 <os arch="i386"/>
67 </condition>
68
69 <if>
70 <os family="unix" />
71 <then>
72 <echo message="OS Family UNIX, ${HostArch}" />
73 </then>
74 <elseif>
75 <os family="dos" />
76 <then>
77 <echo message="OS Family DOS, ${HostArch}" />
78 </then>
79 </elseif>
80 <elseif>
81 <os family="mac" />
82 <then>
83 <echo message="OS Family OS X, ${HostArch}" />
84 </then>
85 </elseif>
86 <else>
87 <fail message="OS Family Unsupported, ${HostArch}" />
88 </else>
89 </if>
90
91 <if>
92 <not>
93 <isset property="ToolChain" />
94 </not>
95 <then>
96 <if>
97 <isset property="env.TOOL_CHAIN" />
98 <then>
99 <property name="ToolChain" value="${env.TOOL_CHAIN}"/>
100 </then>
101 <else>
102 <!-- Default Tool Chain is Microsoft Visual Studio -->
103 <property name="ToolChain" value="msvc"/>
104 </else>
105 </if>
106 </then>
107 </if>
108
109 <if>
110 <equals arg1="${ToolChain}" arg2="gcc" />
111 <then>
112 <exec executable="gcc" outputproperty="host.gcc.ver">
113 <arg line="-E" />
114 <arg line="-P" />
115 <arg line="-x c" />
116 <arg line="gcc.ver" />
117 </exec>
118 <if>
119 <contains string="${host.gcc.ver}" substring="4" />
120 <then>
121 <property name="ExtraArgus" value="-Wno-pointer-sign" />
122 </then>
123 </if>
124 </then>
125 </if>
126
127 <condition property="linux" value="true">
128 <os name="Linux"/>
129 </condition>
130
131 <condition property="intel_win">
132 <and>
133 <os family="dos"/>
134 <equals arg1="${ToolChain}" arg2="intel"/>
135 </and>
136 </condition>
137
138 <condition property="intel_linux">
139 <and>
140 <os name="Linux"/>
141 <equals arg1="${ToolChain}" arg2="intel"/>
142 </and>
143 </condition>
144
145 <condition property="intel_mac">
146 <and>
147 <os family="mac"/>
148 <equals arg1="${ToolChain}" arg2="intel"/>
149 </and>
150 </condition>
151
152 <condition property="gcc">
153 <and>
154 <equals arg1="${ToolChain}" arg2="gcc"/>
155 </and>
156 </condition>
157
158 <condition property="cygwin">
159 <and>
160 <os family="dos"/>
161 <equals arg1="${ToolChain}" arg2="gcc"/>
162 </and>
163 </condition>
164
165 <condition property="x86_64_linux">
166 <and>
167 <os name="Linux"/>
168 <equals arg1="${HostArch}" arg2="X64"/>
169 </and>
170 </condition>
171
172 <condition property="windows" value="true">
173 <os family="Windows"/>
174 </condition>
175
176 <condition property="OSX" value="true">
177 <os family="Mac"/>
178 </condition>
179
180 <condition property="cyglinux">
181 <or>
182 <istrue value="${linux}"/>
183 <istrue value="${cygwin}"/>
184 </or>
185 </condition>
186
187 <!-- msft is a family, used by both Microsoft and Intel Windows compiler tool chains -->
188 <condition property="msft">
189 <isfalse value="${gcc}"/>
190 </condition>
191
192 <if>
193 <istrue value="${ReallyVerbose}"/>
194 <then>
195 <echo message="Test property msvc: ${msvc}"/>
196 <echo message="Test property gcc: ${gcc}"/>
197 <echo message="Test property intel_win: ${intel_win}"/>
198 <echo message="Test property intel_linux: ${intel_linux}"/>
199 <echo message="Test property intel_mac: ${intel_mac}"/>
200 <echo message="Test property msft: ${msft}"/>
201 <echo message="Test property cygwin: ${cygwin}"/>
202 <echo message="Test property cyglinux: ${cyglinux}"/>
203 <echo message="Test property windows: ${windows}"/>
204 <echo message="Test property linux: ${linux}"/>
205 <echo message="Test property OSX: ${OSX}"/>
206 <echo message="Test property x86_64_linux: ${x86_64_linux}"/>
207 </then>
208 </if>
209
210 <property name="haveLibtool" value="false"/>
211 <if>
212 <and>
213 <not>
214 <isset property="env.CYGWIN_HOME"/>
215 </not>
216 <isset property="cygwin"/>
217 </and>
218 <then>
219 <fail message="You must set the environment variable: CYGWIN_HOME"/>
220 </then>
221 </if>
222
223 <if>
224 <istrue value="${gcc}"/>
225 <then>
226 <property name="ext_static" value=".a"/>
227 <property name="ext_dynamic" value=".so"/>
228 <if>
229 <istrue value="${cygwin}"/>
230 <then>
231 <property name="ext_exe" value=".exe"/>
232 </then>
233 <else>
234 <property name="ext_exe" value=""/>
235 </else>
236 </if>
237 </then>
238 <else>
239 <property name="ext_static" value=".lib"/>
240 <property name="ext_dynamic" value=".dll"/>
241 <property name="ext_exe" value=".exe"/>
242 </else>
243 </if>
244 </target>
245
246 <target name="Libraries" depends="initArch, init">
247 <subant target="" inheritall="true">
248 <fileset dir="${PACKAGE_DIR}"
249 includes="${Libs}"/>
250 </subant>
251 </target>
252
253 <target name="Tools" depends="Libraries">
254 <subant target="" inheritall="true">
255 <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"
256 excludes="${Libs}"/>
257 </subant>
258 </target>
259
260 <target name="clean" depends="initArch">
261 <subant target="clean" inheritall="true">
262 <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
263 </subant>
264 </target>
265
266 <target name="cleanall" depends="initArch">
267 <subant target="cleanall" inheritall="true">
268 <fileset dir="${PACKAGE_DIR}" includes="*/build.xml"/>
269 </subant>
270 <delete dir="${LIB_DIR}"/>
271 </target>
272 </project>