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