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