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