Fix CygWinGCC build failed. When GCC build, map file is not generated. We don't need...
[mirror_edk2.git] / Tools / Conf / BuildMacro.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 name="common">
13 <!-- for user extended tasks or macros -->
14 <import file="UserExtension.xml" optional="true"/>
15
16 <!--
17 Macro for intialize some properties. This Macro build will be called before source file build.
18 -->
19 <macrodef name="Build_Init">
20 <element name="EXTRA.INC" optional="yes"/>
21 <element name="EXTRA.ARG" optional="yes"/>
22
23 <sequential>
24 <var name="OBJECTS" value="" />
25 <var name="SDB_FILES" value="" />
26
27 <mkdir dir="${DEST_DIR_DEBUG}"/>
28 <mkdir dir="${DEST_DIR_OUTPUT}"/>
29
30 <if>
31 <and>
32 <isset property="PCH"/>
33 <not>
34 <equals arg1="${PCH}" arg2=""/>
35 </not>
36 </and>
37 <then>
38 <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"
39 TargetFile="${DEST_DIR_OUTPUT}/AutoGen.h.gch">
40 <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
41 <EXTRA.INC/>
42 </makedeps>
43
44 <OnDependency>
45 <sourcefiles>
46 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
47 </sourcefiles>
48 <targetfiles>
49 <file Name="${DEST_DIR_OUTPUT}/AutoGen.h.gch"/>
50 </targetfiles>
51
52 <sequential>
53 <!-- Generate pre-compiled header -->
54 <cc userdefine="on">
55 <command type="CC" cmd="${PCH}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
56 outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}" libpath="${CC_LIBPATH}"
57 include="${CC_INCLUDEPATH}">
58 <EXTRA.INC/>
59 <argument value="${PCH_FLAGS}"/>
60 <EXTRA.ARG/>
61 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/AutoGen.h"/>
62 </command>
63 </cc>
64
65 <if>
66 <equals arg1="${CC_FAMILY}" arg2="GCC"/>
67 <then>
68 <move file="${DEST_DIR_OUTPUT}/AutoGen.h.obj" tofile="${DEST_DIR_DEBUG}/AutoGen.h.gch" overwrite="true"/>
69 </then>
70 </if>
71 </sequential>
72 </OnDependency>
73
74 <if>
75 <not>
76 <equals arg1="${CC_FAMILY}" arg2="GCC"/>
77 </not>
78 <then>
79 <var name="OBJECTS" value="${OBJECTS} AutoGen.h.obj"/>
80 </then>
81 </if>
82 </then>
83 <else>
84 <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep">
85 <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
86 <EXTRA.INC/>
87 </makedeps>
88 </else>
89 </if>
90 </sequential>
91 </macrodef>
92
93
94 <!--
95 macro definitions for building files with different types
96 -->
97 <!--
98 C Code
99 -->
100 <macrodef name="Build_CCode">
101 <attribute name="FILEPATH"/>
102 <attribute name="FILENAME"/>
103 <attribute name="FILEEXT" default="c"/>
104
105 <element name="EXTRA.INC" optional="yes"/>
106 <element name="EXTRA.ARG" optional="yes"/>
107
108 <sequential>
109 <var name="FILE_BASENAME" value="@{FILENAME}" />
110 <var name="FILE_PATH" value="@{FILEPATH}" />
111 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
112
113 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
114 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
115 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
116 <EXTRA.INC/>
117 </makedeps>
118
119 <OnDependency>
120 <sourcefiles>
121 <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
122 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
123 </sourcefiles>
124 <targetfiles>
125 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
126 </targetfiles>
127
128 <sequential>
129 <cc userdefine="on">
130 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
131 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"
132 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
133 <EXTRA.INC/>
134 <argument value="${CC_FLAGS}"/>
135 <EXTRA.ARG/>
136 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
137 </command>
138 </cc>
139 </sequential>
140 </OnDependency>
141 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
142 <if>
143 <equals arg1="@{FILEPATH}" arg2="." />
144 <then>
145 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
146 </then>
147 <else>
148 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
149 </else>
150 </if>
151 </sequential>
152 </macrodef>
153
154
155 <macrodef name="Build_AUTOGEN">
156 <attribute name="FILEPATH"/>
157 <attribute name="FILENAME"/>
158 <attribute name="FILEEXT" default="c"/>
159
160 <element name="EXTRA.INC" optional="yes"/>
161 <element name="EXTRA.ARG" optional="yes"/>
162
163 <sequential>
164 <var name="FILE_BASENAME" value="@{FILENAME}" />
165 <var name="FILE_PATH" value="@{FILEPATH}" />
166 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
167
168 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
169 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
170 <input file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
171 <EXTRA.INC/>
172 </makedeps>
173
174 <OnDependency>
175 <sourcefiles>
176 <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
177 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
178 </sourcefiles>
179 <targetfiles>
180 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
181 </targetfiles>
182
183 <sequential>
184 <cc userdefine="on">
185 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
186 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"
187 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
188 <EXTRA.INC/>
189 <argument value="${CC_FLAGS}"/>
190 <EXTRA.ARG/>
191 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
192 </command>
193 </cc>
194 </sequential>
195 </OnDependency>
196 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
197 <if>
198 <equals arg1="@{FILEPATH}" arg2="." />
199 <then>
200 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
201 </then>
202 <else>
203 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
204 </else>
205 </if>
206 </sequential>
207 </macrodef>
208
209 <macrodef name="Build_DPX">
210 <attribute name="FILEPATH"/>
211 <attribute name="FILENAME"/>
212 <attribute name="FILEEXT" default="dxs"/>
213
214 <element name="EXTRA.INC" optional="yes"/>
215 <element name="EXTRA.ARG" optional="yes"/>
216
217
218 <sequential>
219 <var name="FILE_BASENAME" value="@{FILENAME}" />
220 <var name="FILE_PATH" value="@{FILEPATH}" />
221 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
222
223 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
224 TargetFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex">
225 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
226 <EXTRA.INC/>
227 </makedeps>
228
229 <OnDependency>
230 <sourcefiles>
231 <!--file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/-->
232 <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
233 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
234 </sourcefiles>
235 <targetfiles>
236 <file name="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
237 </targetfiles>
238
239 <sequential>
240 <cc userdefine="on">
241 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${CC_FAMILY}"
242 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" dpath="${CC_DPATH}"
243 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
244 <EXTRA.INC/>
245 <argument value="${PP_FLAGS}"/>
246 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
247 </command>
248 </cc>
249
250 <gendepex inputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" outputFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
251 </sequential>
252 </OnDependency>
253 </sequential>
254 </macrodef>
255
256 <macrodef name="Build_ASM">
257 <attribute name="FILEPATH"/>
258 <attribute name="FILENAME"/>
259 <attribute name="FILEEXT" default="asm"/>
260
261 <element name="EXTRA.INC" optional="yes"/>
262 <element name="EXTRA.ARG" optional="yes"/>
263
264 <!-- Dispath ASM file, there are three type.
265 asm - Build_Assembly
266 S - Build_Gcc_Assembly
267 s - Build_Ipf_Assembly -->
268 <sequential>
269 <if>
270 <equals arg1="@{FILEEXT}" arg2="asm" />
271 <then>
272 <Build_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
273 <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
274 <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
275 </Build_Assembly>
276 </then>
277 <elseif>
278 <equals arg1="@{FILEEXT}" arg2="S" />
279 <then>
280 <Build_Gcc_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
281 <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
282 <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
283 </Build_Gcc_Assembly>
284 </then>
285 </elseif>
286 <elseif>
287 <equals arg1="@{FILEEXT}" arg2="s" />
288 <then>
289 <Build_IPF_Assembly_Code FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
290 <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
291 <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
292 </Build_IPF_Assembly_Code>
293 </then>
294 </elseif>
295 </if>
296 </sequential>
297 </macrodef>
298
299 <!--
300 IA32/x64 Assembly
301 -->
302 <macrodef name="Build_Assembly">
303 <attribute name="FILEPATH"/>
304 <attribute name="FILENAME"/>
305 <attribute name="FILEEXT" default="asm"/>
306
307 <element name="EXTRA.INC.1" optional="yes"/>
308 <element name="EXTRA.ARG.1" optional="yes"/>
309
310 <sequential>
311 <var name="FILE_BASENAME" value="@{FILENAME}" />
312 <var name="FILE_PATH" value="@{FILEPATH}" />
313 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
314
315 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
316 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
317 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
318 <EXTRA.INC.1/>
319 </makedeps>
320
321 <OnDependency>
322 <sourcefiles>
323 <file Listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
324 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
325 </sourcefiles>
326 <targetfiles>
327 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
328 </targetfiles>
329
330 <sequential>
331 <cc userdefine="on">
332 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
333 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
334 <EXTRA.INC.1/>
335 <argument value="${PP_FLAGS}"/>
336 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
337 </command>
338 </cc>
339
340 <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
341 match="^(#line +1 +.*@{FILEPATH}/@{FILENAME}\.@{FILEEXT}&quot;).+\1"
342 replace=";"
343 flags="gs"/>
344 <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
345 match="^(#line .*)$"
346 replace="; \1"
347 byline="true"/>
348 <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
349 match="([^_a-zA-Z])0x([0-9a-fA-F]+)"
350 replace="\10\2h"
351 flags="g"
352 byline="true"/>
353
354 <cc userdefine="on">
355 <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
356 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"
357 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
358 <EXTRA.INC.1/>
359
360 <argument value="${ASM_FLAGS}"/>
361 <EXTRA.ARG.1/>
362
363 <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
364 </command>
365 </cc>
366 </sequential>
367 </OnDependency>
368 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
369 <if>
370 <equals arg1="@{FILEPATH}" arg2="." />
371 <then>
372 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
373 </then>
374 <else>
375 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
376 </else>
377 </if>
378 </sequential>
379 </macrodef>
380
381 <!--
382 Build GCC assembly code
383 -->
384 <macrodef name="Build_Gcc_Assembly">
385 <attribute name="FILEPATH"/>
386 <attribute name="FILENAME"/>
387 <attribute name="FILEEXT" default="asm"/>
388
389 <element name="EXTRA.INC.1" optional="yes"/>
390 <element name="EXTRA.ARG.1" optional="yes"/>
391
392 <sequential>
393 <var name="FILE_BASENAME" value="@{FILENAME}" />
394 <var name="FILE_PATH" value="@{FILEPATH}" />
395 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
396
397 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
398 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
399 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
400 <EXTRA.INC.1/>
401 </makedeps>
402
403 <OnDependency>
404 <sourcefiles>
405 <file Listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
406 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
407 </sourcefiles>
408 <targetfiles>
409 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
410 </targetfiles>
411
412 <sequential>
413 <cc userdefine="on">
414 <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
415 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"
416 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
417 <EXTRA.INC.1/>
418
419 <argument value="${ASM_FLAGS}"/>
420 <EXTRA.ARG.1/>
421
422 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
423 </command>
424 </cc>
425 </sequential>
426 </OnDependency>
427 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
428 <if>
429 <equals arg1="@{FILEPATH}" arg2="." />
430 <then>
431 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
432 </then>
433 <else>
434 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
435 </else>
436 </if>
437 </sequential>
438 </macrodef>
439
440 <!--
441 IPF Assembly
442 -->
443 <macrodef name="Build_IPF_Assembly_Code">
444 <attribute name="FILEPATH"/>
445 <attribute name="FILENAME"/>
446 <attribute name="FILEEXT" default="s"/>
447
448 <element name="EXTRA.INC.1" optional="yes"/>
449 <element name="EXTRA.ARG.1" optional="yes"/>
450
451 <sequential>
452 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
453
454 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
455 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
456 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
457 <EXTRA.INC.1/>
458 </makedeps>
459
460 <OnDependency>
461 <sourcefiles>
462 <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
463 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
464 </sourcefiles>
465 <targetfiles>
466 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
467 </targetfiles>
468
469 <sequential>
470 <cc userdefine="on">
471 <command type="PP" cmd="${APP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${APP_FAMILY}"
472 dpath="${APP_DPATH}" libpath="${APP_LIBPATH}" include="${APP_INCLUDEPATH}">
473 <EXTRA.INC.1/>
474 <argument value="${APP_FLAGS}"/>
475 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
476 </command>
477 </cc>
478
479 <cc userdefine="on">
480 <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
481 includepathDelimiter="-I" outputDelimiter="-o" dpath="${ASM_DPATH}"
482 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}"
483 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
484 <EXTRA.INC.1/>
485 <argument value="${ASM_FLAGS}"/>
486 <EXTRA.ARG.1/>
487 <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
488 </command>
489 </cc>
490 </sequential>
491 </OnDependency>
492 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
493 <if>
494 <equals arg1="@{FILEPATH}" arg2="." />
495 <then>
496 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
497 </then>
498 <else>
499 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
500 </else>
501 </if>
502 </sequential>
503 </macrodef>
504
505
506 <!--
507 Assembly the preprocessed IPF assembly code
508 -->
509 <macrodef name="Build_IPF_PP_Code">
510 <attribute name="FILEPATH"/>
511 <attribute name="FILENAME"/>
512 <attribute name="FILEEXT" default="i"/>
513
514 <element name="EXTRA.INC" optional="yes"/>
515 <element name="EXTRA.ARG" optional="yes"/>
516
517 <sequential>
518 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
519
520 <cc userdefine="on">
521 <command type="ASM" includepathDelimiter="-I" dpath="${ASM_DPATH}"
522 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">
523 <includepath path="${WORKSPACE_DIR}"/>
524 <includepath path="${MODULE_DIR}"/>
525 <includepath path="${MODULE_DIR}/${ARCH}"/>
526 <EXTRA.INC/>
527
528 <argument value="${ASM_FLAGS}"/>
529 <EXTRA.ARG/>
530 <OutputFile File="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
531
532 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
533 </command>
534 </cc>
535 </sequential>
536 </macrodef>
537
538
539 <!--
540 Library
541 -->
542 <macrodef name="Build_Library">
543 <attribute name="FILENAME" />
544 <attribute name="FILEEXT" default="obj"/>
545
546 <sequential>
547 <var name="FILE_BASENAME" value="@{FILENAME}" />
548 <var name="FILE_PATH" value="." />
549 <mkdir dir="${BIN_DIR}"/>
550
551 <if>
552 <equals arg1="${OBJECTS}" arg2="" trim="true"/>
553 <then>
554 <fail message="No object files"/>
555 </then>
556 </if>
557
558 <OnDependency>
559 <sourcefiles>
560 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
561 </sourcefiles>
562 <targetfiles>
563 <file name="${BIN_DIR}/@{FILENAME}.lib"/>
564 </targetfiles>
565
566 <sequential>
567 <cc userdefine="on">
568 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
569 outputFile="${BIN_DIR}/@{FILENAME}.lib" dpath="${SLINK_DPATH}"
570 libpath="${SLINK_LIBPATH}" include="${SLINK_INCLUDEPATH}">
571 <argument value="${SLINK_FLAGS}"/>
572
573 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
574 </command>
575 </cc>
576 </sequential>
577 </OnDependency>
578 </sequential>
579 </macrodef>
580
581 <!--
582 Unicode -> .sdb
583 -->
584 <macrodef name="Build_UNI">
585 <attribute name="FILEPATH"/>
586 <attribute name="FILENAME"/>
587 <attribute name="FILEEXT" default="uni"/>
588
589 <element name="EXTRA.INC" optional="yes"/>
590 <element name="EXTRA.ARG" optional="yes"/>
591
592 <sequential>
593 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
594 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
595 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb">
596 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
597 <EXTRA.INC/>
598 </makedeps>
599
600 <OnDependency>
601 <sourcefiles>
602 <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
603 </sourcefiles>
604 <targetfiles>
605 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
606 </targetfiles>
607
608 <sequential>
609 <strgather commandtype="parse" newdatabase="true">
610 <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
611 <EXTRA.INC/>
612 <EXTRA.ARG/>
613 <inputfile name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
614 </strgather>
615 </sequential>
616 </OnDependency>
617
618 <var name="SDB_FILES" value="${SDB_FILES}, ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
619 </sequential>
620 </macrodef>
621
622 <!--
623 .sdb(s) -> .c, .h -> .obj
624 -->
625 <macrodef name="Build_Unicode_Database">
626 <attribute name="FILEPATH"/>
627 <attribute name="FILENAME"/>
628 <attribute name="FILEEXT" default="sdb"/>
629
630 <element name="EXTRA.INC" optional="yes"/>
631 <element name="EXTRA.ARG" optional="yes"/>
632
633 <sequential>
634 <var name="FILE_BASENAME" value="@{FILENAME}" />
635 <var name="FILE_PATH" value="@{FILEPATH}" />
636 <OnDependency>
637 <sourcefiles>
638 <file list="${SDB_FILES}"/>
639 <file list="${SOURCE_FILES}"/>
640 </sourcefiles>
641 <targetfiles>
642 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
643 </targetfiles>
644
645 <sequential>
646 <strgather commandtype="scan" outputdatabase="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb" verbose="read">
647 <skipext name=".uni"/>
648 <skipext name=".h"/>
649 <database list="${SDB_FILES}"/>
650 <inputfile name="${SOURCE_FILES}"/>
651 </strgather>
652 </sequential>
653 </OnDependency>
654
655 <OnDependency>
656 <sourcefiles>
657 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
658 </sourcefiles>
659 <targetfiles>
660 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"/>
661 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"/>
662 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
663 </targetfiles>
664
665 <sequential>
666 <strgather basename="@{FILENAME}Strings" commandtype="dump"
667 outputdefines="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"
668 outputhpk="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"
669 outputstring="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c">
670 <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
671 </strgather>
672 </sequential>
673 </OnDependency>
674
675 <OnDependency>
676 <sourcefiles>
677 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
678 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
679 </sourcefiles>
680 <targetfiles>
681 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj"/>
682 </targetfiles>
683
684 <sequential>
685 <cc userdefine="on">
686 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
687 includepathDelimiter="-I" dpath="${CC_DPATH}"
688 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
689 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">
690 <argument value="${CC_FLAGS}"/>
691 <EXTRA.INC />
692 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
693 </command>
694 </cc>
695 </sequential>
696 </OnDependency>
697
698 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
699 <if>
700 <equals arg1="@{FILEPATH}" arg2="." />
701 <then>
702 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}Strings.obj" />
703 </then>
704 <else>
705 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}Strings.obj" />
706 </else>
707 </if>
708 </sequential>
709 </macrodef>
710
711 <!--
712 Vfr
713 -->
714 <macrodef name="Build_VFR">
715 <attribute name="FILEPATH"/>
716 <attribute name="FILENAME"/>
717 <attribute name="FILEEXT" default="vfr"/>
718
719 <element name="EXTRA.INC" optional="yes"/>
720 <element name="EXTRA.ARG" optional="yes"/>
721
722 <sequential>
723 <mkdir dir="${DEST_DIR_DEBUG}/@{FILEPATH}"/>
724
725 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
726 TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
727 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
728 <EXTRA.INC/>
729 </makedeps>
730
731 <OnDependency>
732 <sourcefiles>
733 <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
734 <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
735 </sourcefiles>
736 <targetfiles>
737 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
738 </targetfiles>
739
740 <sequential>
741 <!-- if "TOOLCHIAN FAMILY" is "GCC", it should point the ouput file for preprocess compiler -->
742 <if>
743 <equals arg1="${CC_FAMILY}" arg2="GCC"/>
744 <then>
745 <cc userdefine="on">
746 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
747 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
748 <argument value="${VFRPP_FLAGS} -o ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
749 <!-- Output file of the preprocess -->
750 <EXTRA.INC/>
751 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
752 </command>
753 </cc>
754 </then>
755 <else>
756 <cc userdefine="on">
757 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}"
758 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
759 <argument value="${VFRPP_FLAGS}"/>
760 <!-- Output file of the preprocess -->
761 <EXTRA.INC/>
762 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
763 </command>
764 </cc>
765 </else>
766 </if>
767
768 <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">
769 <EXTRA.INC/>
770 </vfrcompile>
771
772 <cc userdefine="on">
773 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
774 includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"
775 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
776 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
777 <argument value="${CC_FLAGS}"/>
778 <EXTRA.INC/>
779 <EXTRA.ARG/>
780 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.c"/>
781 </command>
782 </cc>
783 </sequential>
784 </OnDependency>
785 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
786 <if>
787 <equals arg1="@{FILEPATH}" arg2="." />
788 <then>
789 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
790 </then>
791 <else>
792 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
793 </else>
794 </if>
795 </sequential>
796 </macrodef>
797
798 <!--
799 Build the real mode ASM file
800 -->
801 <macrodef name="Build_RealAsm">
802 <attribute name="FILEPATH"/>
803 <attribute name="FILENAME"/>
804 <attribute name="FILEEXT" default="asm"/>
805
806 <element name="EXTRA.INC" optional="yes"/>
807 <element name="EXTRA.ARG" optional="yes"/>
808
809 <sequential>
810 <OnDependency>
811 <sourcefiles>
812 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
813 </sourcefiles>
814 <targetfiles>
815 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.cat"/>
816 </targetfiles>
817
818 <sequential>
819 <exec dir="${DEST_DIR_OUTPUT}" executable="${ASM}" failonerror="true">
820 <arg line="/nologo /omf ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT} /Bl${ASMLINK} ${ASMLINK_FLAGS}"/>
821 </exec>
822 <concat destfile="${DEST_DIR_OUTPUT}/@{FILENAME}.cat" binary="yes">
823 <filelist dir="${MODULE_DIR}" files="Blank2.pad"/>
824 <filelist dir="${DEST_DIR_OUTPUT}" files="@{FILENAME}.com"/>
825 </concat>
826 </sequential>
827 </OnDependency>
828 </sequential>
829 </macrodef>
830
831 <!--
832 Build Asl table file
833 -->
834 <macrodef name="Build_ASL">
835 <attribute name="FILEPATH"/>
836 <attribute name="FILENAME"/>
837 <attribute name="FILEEXT" default="asl"/>
838
839 <element name="EXTRA.INC" optional="yes"/>
840 <element name="EXTRA.ARG" optional="yes"/>
841
842 <sequential>
843 <mkdir dir="${DEST_DIR_OUTPUT}"/>
844
845 <OnDependency>
846 <sourcefiles>
847 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
848 </sourcefiles>
849 <targetfiles>
850 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
851 </targetfiles>
852
853 <sequential>
854 <cc userdefine="on">
855 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}" family="${PP_FAMILY}"
856 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
857 <argument value="${APP_FLAGS}"/>
858 <EXTRA.INC/>
859 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
860 </command>
861 </cc>
862
863 <exec dir="${DEST_DIR_OUTPUT}" executable="${ASL}" failonerror="true" outputproperty="ASL_OUTPUT">
864 <arg line="${DEST_DIR_OUTPUT}/@{FILENAME}.i"/>
865 </exec>
866
867 <if>
868 <or>
869 <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 2.0"/>
870 <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 1.0"/>
871 </or>
872 <then>
873 <fail message="Current Asl tool not support Acpi Spec 3.0. Pls update your Asl compiler."/>
874 </then>
875 </if>
876
877 <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="aml"/>
878
879 </sequential>
880 </OnDependency>
881 </sequential>
882 </macrodef>
883
884 <!--
885 Build Asl table c file
886 -->
887 <macrodef name="Build_CCASL">
888 <attribute name="FILEPATH"/>
889 <attribute name="FILENAME"/>
890 <attribute name="FILEEXT" default="c"/>
891
892 <element name="EXTRA.INC" optional="yes"/>
893 <element name="EXTRA.ARG" optional="yes"/>
894
895 <sequential>
896 <mkdir dir="${DEST_DIR_OUTPUT}"/>
897
898 <OnDependency>
899 <sourcefiles>
900 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
901 </sourcefiles>
902 <targetfiles>
903 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
904 </targetfiles>
905
906 <sequential>
907
908 <cc userdefine="on">
909 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
910 outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.obj" dpath="${CC_DPATH}"
911 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
912 <EXTRA.INC/>
913 <argument value="${CC_FLAGS}"/>
914 <EXTRA.ARG/>
915 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
916 </command>
917 </cc>
918
919 <cc userdefine="on">
920 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
921 outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" dpath="${DLINK_DPATH}" >
922 <argument value="${SLINK_FLAGS}"/>
923 <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILENAME}.obj"/>
924 </command>
925 </cc>
926
927 <genacpitable inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
928
929 <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>
930 </sequential>
931 </OnDependency>
932 </sequential>
933 </macrodef>
934 <!--
935 Build ACPI Bin File
936 -->
937 <macrodef name="Build_ACPIBIN">
938 <attribute name="FILEPATH"/>
939 <attribute name="FILENAME"/>
940 <attribute name="FILEEXT" default="bin"/>
941
942 <element name="EXTRA.INC" optional="yes"/>
943 <element name="EXTRA.ARG" optional="yes"/>
944
945 <sequential>
946 <mkdir dir="${DEST_DIR_OUTPUT}"/>
947
948 <OnDependency>
949 <sourcefiles>
950 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
951 </sourcefiles>
952 <targetfiles>
953 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
954 </targetfiles>
955
956 <sequential>
957 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" tofile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
958
959 <exec executable="attrib">
960 <arg line="-r ${DEST_DIR_OUTPUT}/@{FILENAME}.acpi"/>
961 </exec>
962
963 <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>
964 </sequential>
965 </OnDependency>
966 </sequential>
967 </macrodef>
968
969 <!--
970 DUMMY - for skipping the source file which should not be built
971 -->
972 <macrodef name="Build_DUMMY">
973 <attribute name="FILEPATH"/>
974 <attribute name="FILENAME"/>
975 <attribute name="FILEEXT"/>
976
977 <element name="EXTRA.INC" optional="yes"/>
978 <element name="EXTRA.ARG" optional="yes"/>
979
980 <sequential>
981 <!--echo message="Ignoring ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" level="info" /-->
982 </sequential>
983 </macrodef>
984
985 <!--
986 Generate efi file
987 -->
988 <macrodef name="GenEfi">
989 <attribute name="FILEPATH"/>
990 <attribute name="FILENAME"/>
991 <attribute name="FILEEXT" default="efi"/>
992
993 <element name="LIB.ARG" optional="yes"/>
994 <element name="LINK.ARG" optional="yes"/>
995
996 <sequential>
997 <var name="FILE_BASENAME" value="@{FILENAME}" />
998 <var name="FILE_PATH" value="@{FILEPATH}" />
999 <OnDependency>
1000 <sourcefiles>
1001 <file list="${LIBS}"/>
1002 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
1003 </sourcefiles>
1004 <targetfiles>
1005 <file name="${DEST_DIR_DEBUG}/@{FILENAME}.efi"/>
1006 </targetfiles>
1007
1008 <sequential>
1009 <!-- Generate a temporary lib file for object files -->
1010 <cc userdefine="on">
1011 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
1012 outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib"
1013 libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">
1014 <argument value="${SLINK_FLAGS}"/>
1015
1016 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
1017 </command>
1018 </cc>
1019
1020 <!-- Link the temporary lib file with dependent libraries -->
1021 <cc userdefine="on">
1022 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
1023 outputFile="${DEST_DIR_DEBUG}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
1024 libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
1025 <argument value="${DLINK_FLAGS}"/>
1026 <libset libs="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
1027 <LINK.ARG/>
1028 </command>
1029 </cc>
1030
1031 <!-- Convert the dll file to efi file -->
1032 <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
1033 peImage="${DEST_DIR_DEBUG}/@{FILENAME}.dll" time="0"/>
1034
1035 <!-- Copy the efi file to BIN and OUTPUT directory -->
1036 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
1037 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
1038 <if>
1039 <available file="${DEST_DIR_DEBUG}/@{FILENAME}.map" />
1040 <then>
1041 <copy file="${DEST_DIR_DEBUG}/@{FILENAME}.map" tofile="${BIN_DIR}/@{FILENAME}.map" />
1042 </then>
1043 </if>
1044 </sequential>
1045 </OnDependency>
1046 </sequential>
1047 </macrodef>
1048
1049 <!--
1050 Binary
1051 -->
1052 <macrodef name="Build_Binary">
1053 <attribute name="FILEPATH"/>
1054 <attribute name="FILENAME"/>
1055 <attribute name="FILEEXT" default="bin"/>
1056
1057 <element name="EXTRA.INC" optional="yes"/>
1058 <element name="EXTRA.ARG" optional="yes"/>
1059
1060 <sequential>
1061 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1062 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1063 </sequential>
1064 </macrodef>
1065
1066 <!--
1067 Microcode
1068 -->
1069 <macrodef name="Build_MICROCODE">
1070 <attribute name="FILEPATH"/>
1071 <attribute name="FILENAME"/>
1072 <attribute name="FILEEXT" default="TXT"/>
1073
1074 <element name="EXTRA.INC" optional="yes"/>
1075 <element name="EXTRA.ARG" optional="yes"/>
1076
1077 <sequential>
1078 <mkdir dir="${TARGET_DIR}/Microcode"/>
1079 <flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
1080 </sequential>
1081 </macrodef>
1082
1083 <!--
1084 Graphics (bmp, ...)
1085 -->
1086 <macrodef name="Build_BMP">
1087 <attribute name="FILEPATH"/>
1088 <attribute name="FILENAME"/>
1089 <attribute name="FILEEXT" default="bmp"/>
1090
1091 <element name="EXTRA.INC" optional="yes"/>
1092 <element name="EXTRA.ARG" optional="yes"/>
1093
1094 <sequential>
1095 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1096 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1097 </sequential>
1098 </macrodef>
1099
1100 <!--
1101 build EFI file
1102 -->
1103 <macrodef name="Build_EFI">
1104 <attribute name="FILEPATH"/>
1105 <attribute name="FILENAME"/>
1106 <attribute name="FILEEXT" default="efi"/>
1107
1108 <element name="EXTRA.INC" optional="yes"/>
1109 <element name="EXTRA.ARG" optional="yes"/>
1110
1111 <sequential>
1112 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1113 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1114 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1115 </sequential>
1116 </macrodef>
1117
1118 <!--
1119 Build macro for Apriori
1120 -->
1121 <macrodef name="Build_Apriori">
1122 <attribute name="FILEPATH" default="."/>
1123 <attribute name="FILENAME"/>
1124 <attribute name="FILEEXT" default="apr"/>
1125 <attribute name="GUID"/>
1126
1127 <sequential>
1128 <mkdir dir="${FV_DIR}/Apriori" />
1129 <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1130 outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
1131 sectiontype="EFI_SECTION_RAW"/>
1132
1133 <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
1134 fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
1135 <sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
1136 </genffsfile>
1137
1138 </sequential>
1139 </macrodef>
1140
1141 <!--############################################################################
1142 Build Sections
1143 #############################################################################-->
1144 <!--
1145 EFI_SECTION_TE
1146 -->
1147
1148 <macrodef name="EFI_SECTION_TE">
1149 <attribute name="FILEPATH"/>
1150 <attribute name="FILENAME"/>
1151 <attribute name="FILEEXT" default="efi" />
1152
1153 <element name="PRE.PROCESS" optional="yes"/>
1154 <element name="POST.PROCESS" optional="yes"/>
1155
1156 <sequential>
1157 <OnDependency>
1158 <sourcefiles>
1159 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1160 </sourcefiles>
1161 <targetfiles>
1162 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
1163 </targetfiles>
1164
1165 <sequential>
1166 <PRE.PROCESS/>
1167
1168 <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1169 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
1170 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
1171 sectiontype="EFI_SECTION_TE"/>
1172
1173 <POST.PROCESS/>
1174 </sequential>
1175 </OnDependency>
1176 </sequential>
1177 </macrodef>
1178
1179 <!--
1180 EFI_SECTION_PE32
1181 -->
1182 <macrodef name="EFI_SECTION_PE32">
1183 <attribute name="FILEPATH"/>
1184 <attribute name="FILENAME"/>
1185 <attribute name="FILEEXT" default="efi"/>
1186
1187 <element name="PRE.PROCESS" optional="yes"/>
1188 <element name="POST.PROCESS" optional="yes"/>
1189
1190 <sequential>
1191 <OnDependency>
1192 <sourcefiles>
1193 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1194 </sourcefiles>
1195 <targetfiles>
1196 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
1197 </targetfiles>
1198
1199 <sequential>
1200 <PRE.PROCESS/>
1201
1202 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
1203 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
1204 sectiontype="EFI_SECTION_PE32"/>
1205
1206 <POST.PROCESS/>
1207 </sequential>
1208 </OnDependency>
1209 </sequential>
1210 </macrodef>
1211
1212 <!--
1213 EFI_SECTION_VERSION
1214 -->
1215 <macrodef name="EFI_SECTION_VERSION">
1216 <attribute name="FILEPATH"/>
1217 <attribute name="FILENAME"/>
1218 <attribute name="FILEEXT" default="" />
1219 <attribute name="VERSION" default="0000"/>
1220
1221 <element name="PRE.PROCESS" optional="yes"/>
1222 <element name="POST.PROCESS" optional="yes"/>
1223
1224 <sequential>
1225 <if>
1226 <not>
1227 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
1228 </not>
1229
1230 <then>
1231 <PRE.PROCESS/>
1232 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
1233 versionnum="@{VERSION}"
1234 sectiontype="EFI_SECTION_VERSION"/>
1235 <POST.PROCESS/>
1236 </then>
1237 </if>
1238 </sequential>
1239 </macrodef>
1240
1241 <!--
1242 EFI_SECTION_USER_INTERFACE
1243 -->
1244 <macrodef name="EFI_SECTION_USER_INTERFACE">
1245 <attribute name="FILEPATH"/>
1246 <attribute name="FILENAME"/>
1247 <attribute name="FILEEXT" default="" />
1248 <attribute name="UI" default="${BASE_NAME}"/>
1249
1250 <element name="PRE.PROCESS" optional="yes"/>
1251 <element name="POST.PROCESS" optional="yes"/>
1252
1253 <sequential>
1254 <if>
1255 <not>
1256 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
1257 </not>
1258
1259 <then>
1260 <PRE.PROCESS/>
1261 <gensection interfacestring="@{UI}"
1262 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
1263 sectiontype="EFI_SECTION_USER_INTERFACE"/>
1264 <POST.PROCESS/>
1265 </then>
1266 </if>
1267 </sequential>
1268 </macrodef>
1269
1270 <!--
1271 EFI_SECTION_DXE_DEPEX
1272 -->
1273 <macrodef name="EFI_SECTION_DXE_DEPEX">
1274 <attribute name="FILEPATH"/>
1275 <attribute name="FILENAME"/>
1276 <attribute name="FILEEXT" default="dxs"/>
1277
1278 <element name="PRE.PROCESS" optional="yes"/>
1279 <element name="POST.PROCESS" optional="yes"/>
1280
1281 <sequential>
1282 <PRE.PROCESS/>
1283
1284 <if>
1285 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1286 <then>
1287 <OnDependency>
1288 <sourcefiles>
1289 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1290 </sourcefiles>
1291 <targetfiles>
1292 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1293 </targetfiles>
1294 <sequential>
1295 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1296 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1297 sectiontype="EFI_SECTION_DXE_DEPEX"/>
1298 </sequential>
1299 </OnDependency>
1300 </then>
1301 <else>
1302 <if>
1303 <not>
1304 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1305 </not>
1306 <then>
1307 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1308 </then>
1309 </if>
1310 </else>
1311 </if>
1312
1313 <POST.PROCESS/>
1314 </sequential>
1315 </macrodef>
1316
1317 <!--
1318 EFI_SECTION_PEI_DEPEX
1319 -->
1320 <macrodef name="EFI_SECTION_PEI_DEPEX">
1321 <attribute name="FILEPATH"/>
1322 <attribute name="FILENAME"/>
1323 <attribute name="FILEEXT" default="dxs"/>
1324
1325 <element name="PRE.PROCESS" optional="yes"/>
1326 <element name="POST.PROCESS" optional="yes"/>
1327 <sequential>
1328 <PRE.PROCESS/>
1329 <if>
1330 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1331 <then>
1332 <OnDependency>
1333 <sourcefiles>
1334 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1335 </sourcefiles>
1336 <targetfiles>
1337 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1338 </targetfiles>
1339
1340 <sequential>
1341 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1342 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1343 sectiontype="EFI_SECTION_PEI_DEPEX"/>
1344 </sequential>
1345 </OnDependency>
1346
1347 </then>
1348 <else>
1349 <if>
1350 <not>
1351 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1352 </not>
1353 <then>
1354 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1355 </then>
1356 </if>
1357 </else>
1358 </if>
1359 <POST.PROCESS/>
1360 </sequential>
1361 </macrodef>
1362
1363
1364 <!--
1365 EFI_SECTION_RAW
1366 -->
1367 <macrodef name="EFI_SECTION_RAW">
1368 <attribute name="FILEPATH"/>
1369 <attribute name="FILENAME"/>
1370 <attribute name="FILEEXT" default="bin"/>
1371
1372 <element name="PRE.PROCESS" optional="yes"/>
1373 <element name="POST.PROCESS" optional="yes"/>
1374
1375 <sequential>
1376 <OnDependency>
1377 <sourcefiles>
1378 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1379 </sourcefiles>
1380 <targetfiles>
1381 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1382 </targetfiles>
1383
1384 <sequential>
1385 <PRE.PROCESS/>
1386 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1387 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1388 sectiontype="EFI_SECTION_RAW"/>
1389 <POST.PROCESS/>
1390 </sequential>
1391 </OnDependency>
1392 </sequential>
1393 </macrodef>
1394
1395 <!--
1396 EFI_SECTION_RAW_SEC
1397 -->
1398 <macrodef name="EFI_SECTION_RAW_SEC">
1399 <attribute name="FILEPATH"/>
1400 <attribute name="FILENAME"/>
1401 <attribute name="FILEEXT" default="cat"/>
1402
1403 <element name="PRE.PROCESS" optional="yes"/>
1404 <element name="POST.PROCESS" optional="yes"/>
1405
1406 <sequential>
1407 <OnDependency>
1408 <sourcefiles>
1409 <file name="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"/>
1410 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.te"/>
1411 </sourcefiles>
1412 <targetfiles>
1413 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1414 </targetfiles>
1415
1416 <sequential>
1417 <PRE.PROCESS/>
1418 <secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"
1419 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>
1420
1421 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
1422 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1423 sectiontype="EFI_SECTION_RAW"/>
1424 <POST.PROCESS/>
1425 </sequential>
1426 </OnDependency>
1427 </sequential>
1428 </macrodef>
1429
1430 <!--
1431 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1432 -->
1433 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
1434 <attribute name="FILEPATH"/>
1435 <attribute name="FILENAME"/>
1436 <attribute name="FILEEXT" default="fv"/>
1437
1438 <element name="PRE.PROCESS" optional="yes"/>
1439 <element name="POST.PROCESS" optional="yes"/>
1440
1441 <sequential>
1442 <OnDependency>
1443 <sourcefiles>
1444 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1445 </sourcefiles>
1446 <targetfiles>
1447 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
1448 </targetfiles>
1449
1450 <sequential>
1451 <PRE.PROCESS/>
1452
1453 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1454 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1455 overwrite="true"/>
1456 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1457 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
1458 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
1459
1460 <POST.PROCESS/>
1461 </sequential>
1462 </OnDependency>
1463 </sequential>
1464 </macrodef>
1465
1466 </project>