45c7ddc32bea2b3c3542f83d0a44e10b6231a840
[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} ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
716 <!-- Output file of the preprocess -->
717 <EXTRA.INC/>
718 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
719 </command>
720 </cc>
721
722 <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">
723 <EXTRA.INC/>
724 </vfrcompile>
725
726 <cc userdefine="on">
727 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
728 includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"
729 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"
730 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
731 <argument value="${CC_FLAGS}"/>
732 <EXTRA.INC/>
733 <EXTRA.ARG/>
734 <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.c"/>
735 </command>
736 </cc>
737 </sequential>
738 </OnDependency>
739 <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->
740 <if>
741 <equals arg1="@{FILEPATH}" arg2="." />
742 <then>
743 <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />
744 </then>
745 <else>
746 <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />
747 </else>
748 </if>
749 </sequential>
750 </macrodef>
751
752 <!--
753 Build the real mode ASM file
754 -->
755 <macrodef name="Build_RealAsm">
756 <attribute name="FILEPATH"/>
757 <attribute name="FILENAME"/>
758 <attribute name="FILEEXT" default="asm"/>
759
760 <element name="EXTRA.INC" optional="yes"/>
761 <element name="EXTRA.ARG" optional="yes"/>
762
763 <sequential>
764 <!-- Lack Dependency Check -->
765 <exec dir="${DEST_DIR_OUTPUT}" executable="${ASM}" failonerror="true">
766 <arg line="/nologo /omf ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT} /Bl${ASMLINK} ${ASMLINK_FLAGS}"/>
767 </exec>
768 <concat destfile="${DEST_DIR_OUTPUT}/@{FILENAME}.cat" binary="yes">
769 <filelist dir="${MODULE_DIR}" files="Blank2.pad"/>
770 <filelist dir="${DEST_DIR_OUTPUT}" files="@{FILENAME}.com"/>
771 </concat>
772 </sequential>
773 </macrodef>
774
775 <!--
776 Build Asl table file
777 -->
778 <macrodef name="Build_ASL">
779 <attribute name="FILEPATH"/>
780 <attribute name="FILENAME"/>
781 <attribute name="FILEEXT" default="asl"/>
782
783 <element name="EXTRA.INC" optional="yes"/>
784 <element name="EXTRA.ARG" optional="yes"/>
785
786 <sequential>
787 <mkdir dir="${DEST_DIR_OUTPUT}"/>
788
789 <OnDependency>
790 <sourcefiles>
791 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
792 </sourcefiles>
793 <targetfiles>
794 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
795 </targetfiles>
796
797 <sequential>
798 <cc userdefine="on">
799 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}" family="${PP_FAMILY}"
800 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">
801 <argument value="${APP_FLAGS}"/>
802 <EXTRA.INC/>
803 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
804 </command>
805 </cc>
806
807 <exec dir="${DEST_DIR_OUTPUT}" executable="${ASL}" failonerror="true" outputproperty="ASL_OUTPUT">
808 <arg line="${DEST_DIR_OUTPUT}/@{FILENAME}.i"/>
809 </exec>
810
811 <if>
812 <or>
813 <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 2.0"/>
814 <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 1.0"/>
815 </or>
816 <then>
817 <fail message="Current Asl tool not support Acpi Spec 3.0. Pls update your Asl compiler."/>
818 </then>
819 </if>
820
821 <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="aml"/>
822
823 </sequential>
824 </OnDependency>
825 </sequential>
826 </macrodef>
827
828 <!--
829 Build Asl table c file
830 -->
831 <macrodef name="Build_CCASL">
832 <attribute name="FILEPATH"/>
833 <attribute name="FILENAME"/>
834 <attribute name="FILEEXT" default="c"/>
835
836 <element name="EXTRA.INC" optional="yes"/>
837 <element name="EXTRA.ARG" optional="yes"/>
838
839 <sequential>
840 <mkdir dir="${DEST_DIR_OUTPUT}"/>
841
842 <OnDependency>
843 <sourcefiles>
844 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
845 </sourcefiles>
846 <targetfiles>
847 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
848 </targetfiles>
849
850 <sequential>
851
852 <cc userdefine="on">
853 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
854 outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.obj" dpath="${CC_DPATH}"
855 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">
856 <EXTRA.INC/>
857 <argument value="${CC_FLAGS}"/>
858 <EXTRA.ARG/>
859 <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
860 </command>
861 </cc>
862
863 <cc userdefine="on">
864 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
865 outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" dpath="${DLINK_DPATH}" >
866 <argument value="${SLINK_FLAGS}"/>
867 <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILENAME}.obj"/>
868 </command>
869 </cc>
870
871 <genacpitable inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />
872
873 <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>
874 </sequential>
875 </OnDependency>
876 </sequential>
877 </macrodef>
878
879 <!--
880 DUMMY
881 -->
882 <macrodef name="Build_DUMMY">
883 <attribute name="FILEPATH"/>
884 <attribute name="FILENAME"/>
885 <attribute name="FILEEXT"/>
886
887 <element name="EXTRA.INC" optional="yes"/>
888 <element name="EXTRA.ARG" optional="yes"/>
889
890 <sequential>
891 <!--echo message="Ignoring ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" level="info" /-->
892 </sequential>
893 </macrodef>
894
895 <!--############################################################################
896 Build Sections
897 #############################################################################-->
898 <!--
899 DLL
900 -->
901 <macrodef name="GenDll">
902 <attribute name="FILEPATH"/>
903 <attribute name="FILENAME"/>
904 <attribute name="FILEEXT"/>
905
906 <element name="LIB.ARG" optional="yes"/>
907 <element name="LINK.ARG" optional="yes"/>
908
909 <sequential>
910 <var name="FILE_BASENAME" value="@{FILENAME}" />
911 <var name="FILE_PATH" value="@{FILEPATH}" />
912 <OnDependency>
913 <sourcefiles>
914 <file list="${LIBS}"/>
915 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
916 </sourcefiles>
917 <targetfiles>
918 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
919 </targetfiles>
920
921 <sequential>
922 <cc userdefine="on">
923 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
924 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"
925 libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">
926 <argument value="${SLINK_FLAGS}"/>
927
928 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
929 </command>
930 </cc>
931 <cc userdefine="on">
932 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
933 outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
934 libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
935 <argument value="${DLINK_FLAGS}"/>
936 <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
937 <LINK.ARG/>
938 </command>
939 </cc>
940 </sequential>
941 </OnDependency>
942 </sequential>
943 </macrodef>
944
945 <!--
946 EFI
947 -->
948 <macrodef name="GenEfi">
949 <attribute name="FILEPATH"/>
950 <attribute name="FILENAME"/>
951 <attribute name="FILEEXT" default="dll"/>
952
953 <sequential>
954 <OnDependency>
955 <sourcefiles>
956 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
957 </sourcefiles>
958 <targetfiles>
959 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
960 </targetfiles>
961
962 <sequential>
963 <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
964 peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
965 </sequential>
966 </OnDependency>
967 </sequential>
968 </macrodef>
969
970 <!--
971 EFI_SECTION_FREEFORM_SUBTYPE_GUID
972 EFI_SECTION_VERSION
973 EFI_SECTION_USER_INTERFACE
974 EFI_SECTION_DXE_DEPEX
975 EFI_SECTION_PEI_DEPEX
976 EFI_SECTION_PE32
977 EFI_SECTION_PIC
978 EFI_SECTION_TE
979 EFI_SECTION_RAW
980 EFI_SECTION_COMPRESSION
981 EFI_SECTION_GUID_DEFINED
982 EFI_SECTION_COMPATIBILITY16
983 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
984 -->
985 <!--
986 EFI_SECTION_PE32
987 -->
988
989 <macrodef name="EFI_SECTION_TE">
990 <attribute name="FILEPATH"/>
991 <attribute name="FILENAME"/>
992 <attribute name="FILEEXT" default="" />
993
994 <element name="PRE.PROCESS" optional="yes"/>
995 <element name="POST.PROCESS" optional="yes"/>
996
997 <sequential>
998 <PRE.PROCESS/>
999 <if>
1000 <not>
1001 <equals arg1="${LIBS}" arg2=""/>
1002 </not>
1003
1004 <then>
1005 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
1006 <LIB.ARG></LIB.ARG>
1007 <LINK.ARG></LINK.ARG>
1008 </GenDll>
1009
1010 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
1011 </then>
1012 </if>
1013
1014 <OnDependency>
1015 <sourcefiles>
1016 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1017 </sourcefiles>
1018 <targetfiles>
1019 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
1020 </targetfiles>
1021
1022 <sequential>
1023 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
1024 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
1025 <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1026 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
1027 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
1028 sectiontype="EFI_SECTION_TE"/>
1029 <POST.PROCESS/>
1030 </sequential>
1031 </OnDependency>
1032 </sequential>
1033 </macrodef>
1034
1035 <macrodef name="EFI_SECTION_PE32">
1036 <attribute name="FILEPATH"/>
1037 <attribute name="FILENAME"/>
1038 <attribute name="FILEEXT" default="" />
1039
1040 <element name="PRE.PROCESS" optional="yes"/>
1041 <element name="POST.PROCESS" optional="yes"/>
1042
1043 <sequential>
1044 <PRE.PROCESS/>
1045 <if>
1046 <not>
1047 <!-- TBD ${OBJECTS} -->
1048 <equals arg1="${LIBS}" arg2=""/>
1049 </not>
1050
1051 <then>
1052 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
1053 <LIB.ARG></LIB.ARG>
1054 <LINK.ARG></LINK.ARG>
1055 </GenDll>
1056
1057 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
1058 </then>
1059 </if>
1060
1061 <OnDependency>
1062 <sourcefiles>
1063 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1064 </sourcefiles>
1065 <targetfiles>
1066 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
1067 </targetfiles>
1068
1069 <sequential>
1070 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
1071 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
1072 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
1073 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
1074 sectiontype="EFI_SECTION_PE32"/>
1075
1076 <POST.PROCESS/>
1077 </sequential>
1078 </OnDependency>
1079 </sequential>
1080 </macrodef>
1081
1082 <!--
1083 EFI_SECTION_VERSION
1084 -->
1085 <macrodef name="EFI_SECTION_VERSION">
1086 <attribute name="FILEPATH"/>
1087 <attribute name="FILENAME"/>
1088 <attribute name="FILEEXT" default="" />
1089 <attribute name="VERSION" default="0000"/>
1090
1091 <element name="PRE.PROCESS" optional="yes"/>
1092 <element name="POST.PROCESS" optional="yes"/>
1093
1094 <sequential>
1095 <if>
1096 <not>
1097 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
1098 </not>
1099
1100 <then>
1101 <PRE.PROCESS/>
1102 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
1103 versionnum="@{VERSION}"
1104 sectiontype="EFI_SECTION_VERSION"/>
1105 <POST.PROCESS/>
1106 </then>
1107 </if>
1108 </sequential>
1109 </macrodef>
1110
1111 <!--
1112 EFI_SECTION_USER_INTERFACE
1113 -->
1114 <macrodef name="EFI_SECTION_USER_INTERFACE">
1115 <attribute name="FILEPATH"/>
1116 <attribute name="FILENAME"/>
1117 <attribute name="FILEEXT" default="" />
1118 <attribute name="UI" default="${BASE_NAME}"/>
1119
1120 <element name="PRE.PROCESS" optional="yes"/>
1121 <element name="POST.PROCESS" optional="yes"/>
1122
1123 <sequential>
1124 <if>
1125 <not>
1126 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
1127 </not>
1128
1129 <then>
1130 <PRE.PROCESS/>
1131 <gensection interfacestring="@{UI}"
1132 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
1133 sectiontype="EFI_SECTION_USER_INTERFACE"/>
1134 <POST.PROCESS/>
1135 </then>
1136 </if>
1137 </sequential>
1138 </macrodef>
1139
1140 <!--
1141 EFI_SECTION_DXE_DEPEX
1142 -->
1143 <macrodef name="EFI_SECTION_DXE_DEPEX">
1144 <attribute name="FILEPATH"/>
1145 <attribute name="FILENAME"/>
1146 <attribute name="FILEEXT" default="dxs"/>
1147
1148 <element name="PRE.PROCESS" optional="yes"/>
1149 <element name="POST.PROCESS" optional="yes"/>
1150
1151 <sequential>
1152 <PRE.PROCESS/>
1153
1154 <if>
1155 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1156 <then>
1157 <OnDependency>
1158 <sourcefiles>
1159 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1160 </sourcefiles>
1161 <targetfiles>
1162 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1163 </targetfiles>
1164 <sequential>
1165 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1166 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1167 sectiontype="EFI_SECTION_DXE_DEPEX"/>
1168 </sequential>
1169 </OnDependency>
1170 </then>
1171 <else>
1172 <if>
1173 <not>
1174 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1175 </not>
1176 <then>
1177 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1178 </then>
1179 </if>
1180 </else>
1181 </if>
1182
1183 <POST.PROCESS/>
1184 </sequential>
1185 </macrodef>
1186
1187 <!--
1188 EFI_SECTION_PEI_DEPEX
1189 -->
1190 <macrodef name="EFI_SECTION_PEI_DEPEX">
1191 <attribute name="FILEPATH"/>
1192 <attribute name="FILENAME"/>
1193 <attribute name="FILEEXT" default="dxs"/>
1194
1195 <element name="PRE.PROCESS" optional="yes"/>
1196 <element name="POST.PROCESS" optional="yes"/>
1197 <sequential>
1198 <PRE.PROCESS/>
1199 <if>
1200 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1201 <then>
1202 <OnDependency>
1203 <sourcefiles>
1204 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1205 </sourcefiles>
1206 <targetfiles>
1207 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1208 </targetfiles>
1209
1210 <sequential>
1211 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1212 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1213 sectiontype="EFI_SECTION_PEI_DEPEX"/>
1214 </sequential>
1215 </OnDependency>
1216
1217 </then>
1218 <else>
1219 <if>
1220 <not>
1221 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1222 </not>
1223 <then>
1224 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1225 </then>
1226 </if>
1227 </else>
1228 </if>
1229 <POST.PROCESS/>
1230 </sequential>
1231 </macrodef>
1232
1233
1234 <!--
1235 EFI_SECTION_RAW
1236 -->
1237 <macrodef name="EFI_SECTION_RAW">
1238 <attribute name="FILEPATH"/>
1239 <attribute name="FILENAME"/>
1240 <attribute name="FILEEXT" default="bin"/>
1241
1242 <element name="PRE.PROCESS" optional="yes"/>
1243 <element name="POST.PROCESS" optional="yes"/>
1244
1245 <sequential>
1246 <OnDependency>
1247 <sourcefiles>
1248 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1249 </sourcefiles>
1250 <targetfiles>
1251 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1252 </targetfiles>
1253
1254 <sequential>
1255 <PRE.PROCESS/>
1256 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1257 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1258 sectiontype="EFI_SECTION_RAW"/>
1259 <POST.PROCESS/>
1260 </sequential>
1261 </OnDependency>
1262 </sequential>
1263 </macrodef>
1264
1265 <!--
1266 EFI_SECTION_RAW_SEC
1267 -->
1268 <macrodef name="EFI_SECTION_RAW_SEC">
1269 <attribute name="FILEPATH"/>
1270 <attribute name="FILENAME"/>
1271 <attribute name="FILEEXT" default="cat"/>
1272
1273 <element name="PRE.PROCESS" optional="yes"/>
1274 <element name="POST.PROCESS" optional="yes"/>
1275
1276 <sequential>
1277 <OnDependency>
1278 <sourcefiles>
1279 <file name="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"/>
1280 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.te"/>
1281 </sourcefiles>
1282 <targetfiles>
1283 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1284 </targetfiles>
1285
1286 <sequential>
1287 <PRE.PROCESS/>
1288 <secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"
1289 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>
1290
1291 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
1292 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1293 sectiontype="EFI_SECTION_RAW"/>
1294 <POST.PROCESS/>
1295 </sequential>
1296 </OnDependency>
1297 </sequential>
1298 </macrodef>
1299
1300 <!--
1301 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1302 -->
1303 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
1304 <attribute name="FILEPATH"/>
1305 <attribute name="FILENAME"/>
1306 <attribute name="FILEEXT" default="fv"/>
1307
1308 <element name="PRE.PROCESS" optional="yes"/>
1309 <element name="POST.PROCESS" optional="yes"/>
1310
1311 <sequential>
1312 <OnDependency>
1313 <sourcefiles>
1314 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1315 </sourcefiles>
1316 <targetfiles>
1317 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
1318 </targetfiles>
1319
1320 <sequential>
1321 <PRE.PROCESS/>
1322
1323 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1324 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1325 overwrite="true"/>
1326 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1327 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
1328 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
1329
1330 <POST.PROCESS/>
1331 </sequential>
1332 </OnDependency>
1333 </sequential>
1334 </macrodef>
1335
1336 <!--
1337 Binary
1338 -->
1339 <macrodef name="Build_Binary">
1340 <attribute name="FILEPATH"/>
1341 <attribute name="FILENAME"/>
1342 <attribute name="FILEEXT" default="bin"/>
1343
1344 <element name="EXTRA.INC" optional="yes"/>
1345 <element name="EXTRA.ARG" optional="yes"/>
1346
1347 <sequential>
1348 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1349 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1350 </sequential>
1351 </macrodef>
1352
1353 <!--
1354 Microcode
1355 -->
1356 <macrodef name="Build_MICROCODE">
1357 <attribute name="FILEPATH"/>
1358 <attribute name="FILENAME"/>
1359 <attribute name="FILEEXT" default="TXT"/>
1360
1361 <element name="EXTRA.INC" optional="yes"/>
1362 <element name="EXTRA.ARG" optional="yes"/>
1363
1364 <sequential>
1365 <mkdir dir="${TARGET_DIR}/Microcode"/>
1366 <flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
1367 </sequential>
1368 </macrodef>
1369
1370 <!--
1371 Graphics (bmp, ...)
1372 -->
1373 <macrodef name="Build_BMP">
1374 <attribute name="FILEPATH"/>
1375 <attribute name="FILENAME"/>
1376 <attribute name="FILEEXT" default="bmp"/>
1377
1378 <element name="EXTRA.INC" optional="yes"/>
1379 <element name="EXTRA.ARG" optional="yes"/>
1380
1381 <sequential>
1382 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1383 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1384 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1385 </sequential>
1386 </macrodef>
1387
1388 <!--
1389 build EFI file
1390 -->
1391 <macrodef name="Build_EFI">
1392 <attribute name="FILEPATH"/>
1393 <attribute name="FILENAME"/>
1394 <attribute name="FILEEXT" default="efi"/>
1395
1396 <element name="EXTRA.INC" optional="yes"/>
1397 <element name="EXTRA.ARG" optional="yes"/>
1398
1399 <sequential>
1400 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1401 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1402 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1403 </sequential>
1404 </macrodef>
1405
1406 <!--
1407 Build macro for Apriori
1408 -->
1409 <macrodef name="Build_Apriori">
1410 <attribute name="FILEPATH" default="."/>
1411 <attribute name="FILENAME"/>
1412 <attribute name="FILEEXT" default="apr"/>
1413 <attribute name="GUID"/>
1414
1415 <sequential>
1416 <mkdir dir="${FV_DIR}/Apriori" />
1417 <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1418 outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
1419 sectiontype="EFI_SECTION_RAW"/>
1420
1421 <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
1422 fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
1423 <sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
1424 </genffsfile>
1425
1426 </sequential>
1427 </macrodef>
1428 </project>