621ec609cbf8bd5f2c3fd1cb7f974b367939dbe3
[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 </sourcefiles>
646 <targetfiles>
647 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj"/>
648 </targetfiles>
649
650 <sequential>
651 <cc userdefine="on">
652 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
653 includepathDelimiter="-I" dpath="${CC_DPATH}"
654 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
655 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">
656 <argument value="${CC_FLAGS}"/>
657 <EXTRA.INC />
658 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
659 </command>
660 </cc>
661 </sequential>
662 </OnDependency>
663
664 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
665 <if>
666 <equals arg1="@{FILEPATH}" arg2="." />
667 <then>
668 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}Strings.obj" />
669 </then>
670 <else>
671 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}Strings.obj" />
672 </else>
673 </if>
674 </sequential>
675 </macrodef>
676
677 <!--
678 Vfr
679 -->
680 <macrodef name="Build_VFR">
681 <attribute name="FILEPATH"/>
682 <attribute name="FILENAME"/>
683 <attribute name="FILEEXT" default="vfr"/>
684
685 <element name="EXTRA.INC" optional="yes"/>
686 <element name="EXTRA.ARG" optional="yes"/>
687
688 <sequential>
689 <mkdir dir="${DEST_DIR_DEBUG}/@{FILEPATH}"/>
690
691 <if>
692 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
693 <then>
694 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
695 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
696 <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
697 <EXTRA.INC/>
698 </makedeps>
699 </then>
700 </if>
701
702 <OnDependency>
703 <sourcefiles>
704 <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
705 </sourcefiles>
706 <targetfiles>
707 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
708 </targetfiles>
709
710 <sequential>
711 <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}">
712 <EXTRA.INC/>
713 </vfrcompile>
714
715 <cc userdefine="on">
716 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
717 includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"
718 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
719 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
720 <argument value="${CC_FLAGS}"/>
721 <EXTRA.INC/>
722 <EXTRA.ARG/>
723 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.c"/>
724 </command>
725 </cc>
726 </sequential>
727 </OnDependency>
728 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
729 <if>
730 <equals arg1="@{FILEPATH}" arg2="." />
731 <then>
732 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
733 </then>
734 <else>
735 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
736 </else>
737 </if>
738 </sequential>
739 </macrodef>
740
741 <!--
742 Build the real mode ASM file
743 -->
744 <macrodef name="Build_RealAsm">
745 <attribute name="FILEPATH"/>
746 <attribute name="FILENAME"/>
747 <attribute name="FILEEXT" default="asm"/>
748
749 <element name="EXTRA.INC" optional="yes"/>
750 <element name="EXTRA.ARG" optional="yes"/>
751
752 <sequential>
753 <!-- Lack Dependency Check -->
754 <exec dir="${DEST_DIR_OUTPUT}" executable="${ASM}" failonerror="true">
755 <arg line="/nologo /omf ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT} /Bl${ASMLINK} ${ASMLINK_FLAGS}"/>
756 </exec>
757 <concat destfile="${DEST_DIR_OUTPUT}/@{FILENAME}.cat" binary="yes">
758 <filelist dir="${MODULE_DIR}" files="Blank2.pad"/>
759 <filelist dir="${DEST_DIR_OUTPUT}" files="@{FILENAME}.com"/>
760 </concat>
761 </sequential>
762 </macrodef>
763
764 <!--
765 DUMMY
766 -->
767 <macrodef name="Build_DUMMY">
768 <attribute name="FILEPATH"/>
769 <attribute name="FILENAME"/>
770 <attribute name="FILEEXT"/>
771
772 <element name="EXTRA.INC" optional="yes"/>
773 <element name="EXTRA.ARG" optional="yes"/>
774
775 <sequential>
776 <echo message="Ignoring ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" level="info" />
777 </sequential>
778 </macrodef>
779
780 <!--############################################################################
781 Build Sections
782 #############################################################################-->
783 <!--
784 DLL
785 -->
786 <macrodef name="GenDll">
787 <attribute name="FILEPATH"/>
788 <attribute name="FILENAME"/>
789 <attribute name="FILEEXT"/>
790
791 <element name="LIB.ARG" optional="yes"/>
792 <element name="LINK.ARG" optional="yes"/>
793
794 <sequential>
795 <var name="FILE_BASENAME" value="@{FILENAME}" />
796 <var name="FILE_PATH" value="@{FILEPATH}" />
797 <OnDependency>
798 <sourcefiles>
799 <file list="${LIBS}"/>
800 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
801 </sourcefiles>
802 <targetfiles>
803 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
804 </targetfiles>
805
806 <sequential>
807 <cc userdefine="on">
808 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
809 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"
810 libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">
811 <argument value="${SLINK_FLAGS}"/>
812
813 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
814 </command>
815 </cc>
816 <cc userdefine="on">
817 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
818 outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
819 libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
820 <argument value="${DLINK_FLAGS}"/>
821 <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
822 <LINK.ARG/>
823 </command>
824 </cc>
825 </sequential>
826 </OnDependency>
827 </sequential>
828 </macrodef>
829
830 <!--
831 EFI
832 -->
833 <macrodef name="GenEfi">
834 <attribute name="FILEPATH"/>
835 <attribute name="FILENAME"/>
836 <attribute name="FILEEXT" default="dll"/>
837
838 <sequential>
839 <OnDependency>
840 <sourcefiles>
841 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
842 </sourcefiles>
843 <targetfiles>
844 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
845 </targetfiles>
846
847 <sequential>
848 <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
849 peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
850 </sequential>
851 </OnDependency>
852 </sequential>
853 </macrodef>
854
855 <!--
856 EFI_SECTION_FREEFORM_SUBTYPE_GUID
857 EFI_SECTION_VERSION
858 EFI_SECTION_USER_INTERFACE
859 EFI_SECTION_DXE_DEPEX
860 EFI_SECTION_PEI_DEPEX
861 EFI_SECTION_PE32
862 EFI_SECTION_PIC
863 EFI_SECTION_TE
864 EFI_SECTION_RAW
865 EFI_SECTION_COMPRESSION
866 EFI_SECTION_GUID_DEFINED
867 EFI_SECTION_COMPATIBILITY16
868 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
869 -->
870 <!--
871 EFI_SECTION_PE32
872 -->
873
874 <macrodef name="EFI_SECTION_TE">
875 <attribute name="FILEPATH"/>
876 <attribute name="FILENAME"/>
877 <attribute name="FILEEXT" default="" />
878
879 <element name="PRE.PROCESS" optional="yes"/>
880 <element name="POST.PROCESS" optional="yes"/>
881
882 <sequential>
883 <PRE.PROCESS/>
884 <if>
885 <not>
886 <equals arg1="${LIBS}" arg2=""/>
887 </not>
888
889 <then>
890 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
891 <LIB.ARG></LIB.ARG>
892 <LINK.ARG></LINK.ARG>
893 </GenDll>
894
895 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
896 </then>
897 </if>
898
899 <OnDependency>
900 <sourcefiles>
901 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
902 </sourcefiles>
903 <targetfiles>
904 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
905 </targetfiles>
906
907 <sequential>
908 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
909 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
910 <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
911 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
912 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
913 sectiontype="EFI_SECTION_TE"/>
914 <POST.PROCESS/>
915 </sequential>
916 </OnDependency>
917 </sequential>
918 </macrodef>
919
920 <macrodef name="EFI_SECTION_PE32">
921 <attribute name="FILEPATH"/>
922 <attribute name="FILENAME"/>
923 <attribute name="FILEEXT" default="" />
924
925 <element name="PRE.PROCESS" optional="yes"/>
926 <element name="POST.PROCESS" optional="yes"/>
927
928 <sequential>
929 <PRE.PROCESS/>
930 <if>
931 <not>
932 <!-- TBD ${OBJECTS} -->
933 <equals arg1="${LIBS}" arg2=""/>
934 </not>
935
936 <then>
937 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
938 <LIB.ARG></LIB.ARG>
939 <LINK.ARG></LINK.ARG>
940 </GenDll>
941
942 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
943 </then>
944 </if>
945
946 <OnDependency>
947 <sourcefiles>
948 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
949 </sourcefiles>
950 <targetfiles>
951 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
952 </targetfiles>
953
954 <sequential>
955 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
956 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
957 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
958 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
959 sectiontype="EFI_SECTION_PE32"/>
960
961 <POST.PROCESS/>
962 </sequential>
963 </OnDependency>
964 </sequential>
965 </macrodef>
966
967 <!--
968 EFI_SECTION_VERSION
969 -->
970 <macrodef name="EFI_SECTION_VERSION">
971 <attribute name="FILEPATH"/>
972 <attribute name="FILENAME"/>
973 <attribute name="FILEEXT" default="" />
974 <attribute name="VERSION" default="0000"/>
975
976 <element name="PRE.PROCESS" optional="yes"/>
977 <element name="POST.PROCESS" optional="yes"/>
978
979 <sequential>
980 <if>
981 <not>
982 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
983 </not>
984
985 <then>
986 <PRE.PROCESS/>
987 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
988 versionnum="@{VERSION}"
989 sectiontype="EFI_SECTION_VERSION"/>
990 <POST.PROCESS/>
991 </then>
992 </if>
993 </sequential>
994 </macrodef>
995
996 <!--
997 EFI_SECTION_USER_INTERFACE
998 -->
999 <macrodef name="EFI_SECTION_USER_INTERFACE">
1000 <attribute name="FILEPATH"/>
1001 <attribute name="FILENAME"/>
1002 <attribute name="FILEEXT" default="" />
1003 <attribute name="UI" default="${BASE_NAME}"/>
1004
1005 <element name="PRE.PROCESS" optional="yes"/>
1006 <element name="POST.PROCESS" optional="yes"/>
1007
1008 <sequential>
1009 <if>
1010 <not>
1011 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
1012 </not>
1013
1014 <then>
1015 <PRE.PROCESS/>
1016 <gensection interfacestring="@{UI}"
1017 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
1018 sectiontype="EFI_SECTION_USER_INTERFACE"/>
1019 <POST.PROCESS/>
1020 </then>
1021 </if>
1022 </sequential>
1023 </macrodef>
1024
1025 <!--
1026 EFI_SECTION_DXE_DEPEX
1027 -->
1028 <macrodef name="EFI_SECTION_DXE_DEPEX">
1029 <attribute name="FILEPATH"/>
1030 <attribute name="FILENAME"/>
1031 <attribute name="FILEEXT" default="dxs"/>
1032
1033 <element name="PRE.PROCESS" optional="yes"/>
1034 <element name="POST.PROCESS" optional="yes"/>
1035
1036 <sequential>
1037 <PRE.PROCESS/>
1038
1039 <if>
1040 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1041 <then>
1042 <OnDependency>
1043 <sourcefiles>
1044 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1045 </sourcefiles>
1046 <targetfiles>
1047 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1048 </targetfiles>
1049 <sequential>
1050 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1051 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1052 sectiontype="EFI_SECTION_DXE_DEPEX"/>
1053 </sequential>
1054 </OnDependency>
1055 </then>
1056 <else>
1057 <if>
1058 <not>
1059 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1060 </not>
1061 <then>
1062 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1063 </then>
1064 </if>
1065 </else>
1066 </if>
1067
1068 <POST.PROCESS/>
1069 </sequential>
1070 </macrodef>
1071
1072 <!--
1073 EFI_SECTION_PEI_DEPEX
1074 -->
1075 <macrodef name="EFI_SECTION_PEI_DEPEX">
1076 <attribute name="FILEPATH"/>
1077 <attribute name="FILENAME"/>
1078 <attribute name="FILEEXT" default="dxs"/>
1079
1080 <element name="PRE.PROCESS" optional="yes"/>
1081 <element name="POST.PROCESS" optional="yes"/>
1082 <sequential>
1083 <PRE.PROCESS/>
1084 <if>
1085 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1086 <then>
1087 <OnDependency>
1088 <sourcefiles>
1089 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1090 </sourcefiles>
1091 <targetfiles>
1092 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1093 </targetfiles>
1094
1095 <sequential>
1096 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1097 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1098 sectiontype="EFI_SECTION_PEI_DEPEX"/>
1099 </sequential>
1100 </OnDependency>
1101
1102 </then>
1103 <else>
1104 <if>
1105 <not>
1106 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1107 </not>
1108 <then>
1109 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1110 </then>
1111 </if>
1112 </else>
1113 </if>
1114 <POST.PROCESS/>
1115 </sequential>
1116 </macrodef>
1117
1118
1119 <!--
1120 EFI_SECTION_RAW
1121 -->
1122 <macrodef name="EFI_SECTION_RAW">
1123 <attribute name="FILEPATH"/>
1124 <attribute name="FILENAME"/>
1125 <attribute name="FILEEXT" default="bin"/>
1126
1127 <element name="PRE.PROCESS" optional="yes"/>
1128 <element name="POST.PROCESS" optional="yes"/>
1129
1130 <sequential>
1131 <OnDependency>
1132 <sourcefiles>
1133 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"/>
1134 </sourcefiles>
1135 <targetfiles>
1136 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1137 </targetfiles>
1138
1139 <sequential>
1140 <PRE.PROCESS/>
1141 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"
1142 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1143 sectiontype="EFI_SECTION_RAW"/>
1144 <POST.PROCESS/>
1145 </sequential>
1146 </OnDependency>
1147 </sequential>
1148 </macrodef>
1149
1150 <!--
1151 EFI_SECTION_RAW_SEC
1152 -->
1153 <macrodef name="EFI_SECTION_RAW_SEC">
1154 <attribute name="FILEPATH"/>
1155 <attribute name="FILENAME"/>
1156 <attribute name="FILEEXT" default="cat"/>
1157
1158 <element name="PRE.PROCESS" optional="yes"/>
1159 <element name="POST.PROCESS" optional="yes"/>
1160
1161 <sequential>
1162 <OnDependency>
1163 <sourcefiles>
1164 <file name="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"/>
1165 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.te"/>
1166 </sourcefiles>
1167 <targetfiles>
1168 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1169 </targetfiles>
1170
1171 <sequential>
1172 <PRE.PROCESS/>
1173 <secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"
1174 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>
1175
1176 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
1177 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1178 sectiontype="EFI_SECTION_RAW"/>
1179 <POST.PROCESS/>
1180 </sequential>
1181 </OnDependency>
1182 </sequential>
1183 </macrodef>
1184
1185 <!--
1186 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1187 -->
1188 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
1189 <attribute name="FILEPATH"/>
1190 <attribute name="FILENAME"/>
1191 <attribute name="FILEEXT" default="fv"/>
1192
1193 <element name="PRE.PROCESS" optional="yes"/>
1194 <element name="POST.PROCESS" optional="yes"/>
1195
1196 <sequential>
1197 <OnDependency>
1198 <sourcefiles>
1199 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1200 </sourcefiles>
1201 <targetfiles>
1202 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
1203 </targetfiles>
1204
1205 <sequential>
1206 <PRE.PROCESS/>
1207
1208 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1209 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1210 overwrite="true"/>
1211 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1212 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
1213 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
1214
1215 <POST.PROCESS/>
1216 </sequential>
1217 </OnDependency>
1218 </sequential>
1219 </macrodef>
1220
1221 <!--
1222 Binary
1223 -->
1224 <macrodef name="Build_Binary">
1225 <attribute name="FILEPATH"/>
1226 <attribute name="FILENAME"/>
1227 <attribute name="FILEEXT" default="bin"/>
1228
1229 <element name="EXTRA.INC" optional="yes"/>
1230 <element name="EXTRA.ARG" optional="yes"/>
1231
1232 <sequential>
1233 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1234 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1235 </sequential>
1236 </macrodef>
1237
1238 <!--
1239 Microcode
1240 -->
1241 <macrodef name="Build_MICROCODE">
1242 <attribute name="FILEPATH"/>
1243 <attribute name="FILENAME"/>
1244 <attribute name="FILEEXT" default="TXT"/>
1245
1246 <element name="EXTRA.INC" optional="yes"/>
1247 <element name="EXTRA.ARG" optional="yes"/>
1248
1249 <sequential>
1250 <mkdir dir="${TARGET_DIR}/Microcode"/>
1251 <flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
1252 </sequential>
1253 </macrodef>
1254
1255 <!--
1256 Graphics (bmp, ...)
1257 -->
1258 <macrodef name="Build_BMP">
1259 <attribute name="FILEPATH"/>
1260 <attribute name="FILENAME"/>
1261 <attribute name="FILEEXT" default="bmp"/>
1262
1263 <element name="EXTRA.INC" optional="yes"/>
1264 <element name="EXTRA.ARG" optional="yes"/>
1265
1266 <sequential>
1267 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1268 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1269 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1270 </sequential>
1271 </macrodef>
1272
1273 <!--
1274 build EFI file
1275 -->
1276 <macrodef name="Build_EFI">
1277 <attribute name="FILEPATH"/>
1278 <attribute name="FILENAME"/>
1279 <attribute name="FILEEXT" default="efi"/>
1280
1281 <element name="EXTRA.INC" optional="yes"/>
1282 <element name="EXTRA.ARG" optional="yes"/>
1283
1284 <sequential>
1285 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1286 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1287 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1288 </sequential>
1289 </macrodef>
1290 </project>