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