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