Enhanced the <Build_Library> macro to check OBJECTS property in case it's empty
[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 <!--
935 DUMMY - for skipping the source file which should not be built
936 -->
937 <macrodef name="Build_DUMMY">
938 <attribute name="FILEPATH"/>
939 <attribute name="FILENAME"/>
940 <attribute name="FILEEXT"/>
941
942 <element name="EXTRA.INC" optional="yes"/>
943 <element name="EXTRA.ARG" optional="yes"/>
944
945 <sequential>
946 <!--echo message="Ignoring ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" level="info" /-->
947 </sequential>
948 </macrodef>
949
950 <!--############################################################################
951 Build Sections
952 #############################################################################-->
953 <!--
954 DLL
955 -->
956 <macrodef name="GenDll">
957 <attribute name="FILEPATH"/>
958 <attribute name="FILENAME"/>
959 <attribute name="FILEEXT"/>
960
961 <element name="LIB.ARG" optional="yes"/>
962 <element name="LINK.ARG" optional="yes"/>
963
964 <sequential>
965 <var name="FILE_BASENAME" value="@{FILENAME}" />
966 <var name="FILE_PATH" value="@{FILEPATH}" />
967 <OnDependency>
968 <sourcefiles>
969 <file list="${LIBS}"/>
970 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
971 </sourcefiles>
972 <targetfiles>
973 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
974 </targetfiles>
975
976 <sequential>
977 <cc userdefine="on">
978 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
979 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"
980 libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">
981 <argument value="${SLINK_FLAGS}"/>
982
983 <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
984 </command>
985 </cc>
986 <cc userdefine="on">
987 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
988 outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
989 libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
990 <argument value="${DLINK_FLAGS}"/>
991 <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
992 <LINK.ARG/>
993 </command>
994 </cc>
995 </sequential>
996 </OnDependency>
997 </sequential>
998 </macrodef>
999
1000 <!--
1001 EFI
1002 -->
1003 <macrodef name="GenEfi">
1004 <attribute name="FILEPATH"/>
1005 <attribute name="FILENAME"/>
1006 <attribute name="FILEEXT" default="dll"/>
1007
1008 <sequential>
1009 <OnDependency>
1010 <sourcefiles>
1011 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1012 </sourcefiles>
1013 <targetfiles>
1014 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1015 </targetfiles>
1016
1017 <sequential>
1018 <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
1019 peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
1020 </sequential>
1021 </OnDependency>
1022 </sequential>
1023 </macrodef>
1024
1025 <!--
1026 EFI_SECTION_FREEFORM_SUBTYPE_GUID
1027 EFI_SECTION_VERSION
1028 EFI_SECTION_USER_INTERFACE
1029 EFI_SECTION_DXE_DEPEX
1030 EFI_SECTION_PEI_DEPEX
1031 EFI_SECTION_PE32
1032 EFI_SECTION_PIC
1033 EFI_SECTION_TE
1034 EFI_SECTION_RAW
1035 EFI_SECTION_COMPRESSION
1036 EFI_SECTION_GUID_DEFINED
1037 EFI_SECTION_COMPATIBILITY16
1038 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1039 -->
1040 <!--
1041 EFI_SECTION_PE32
1042 -->
1043
1044 <macrodef name="EFI_SECTION_TE">
1045 <attribute name="FILEPATH"/>
1046 <attribute name="FILENAME"/>
1047 <attribute name="FILEEXT" default="" />
1048
1049 <element name="PRE.PROCESS" optional="yes"/>
1050 <element name="POST.PROCESS" optional="yes"/>
1051
1052 <sequential>
1053 <PRE.PROCESS/>
1054 <if>
1055 <not>
1056 <equals arg1="${LIBS}" arg2=""/>
1057 </not>
1058
1059 <then>
1060 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
1061 <LIB.ARG></LIB.ARG>
1062 <LINK.ARG></LINK.ARG>
1063 </GenDll>
1064
1065 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
1066 </then>
1067 </if>
1068
1069 <OnDependency>
1070 <sourcefiles>
1071 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1072 </sourcefiles>
1073 <targetfiles>
1074 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
1075 </targetfiles>
1076
1077 <sequential>
1078 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
1079 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
1080 <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1081 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
1082 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
1083 sectiontype="EFI_SECTION_TE"/>
1084 <POST.PROCESS/>
1085 </sequential>
1086 </OnDependency>
1087 </sequential>
1088 </macrodef>
1089
1090 <macrodef name="EFI_SECTION_PE32">
1091 <attribute name="FILEPATH"/>
1092 <attribute name="FILENAME"/>
1093 <attribute name="FILEEXT" default="" />
1094
1095 <element name="PRE.PROCESS" optional="yes"/>
1096 <element name="POST.PROCESS" optional="yes"/>
1097
1098 <sequential>
1099 <PRE.PROCESS/>
1100 <if>
1101 <not>
1102 <!-- TBD ${OBJECTS} -->
1103 <equals arg1="${LIBS}" arg2=""/>
1104 </not>
1105
1106 <then>
1107 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
1108 <LIB.ARG></LIB.ARG>
1109 <LINK.ARG></LINK.ARG>
1110 </GenDll>
1111
1112 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
1113 </then>
1114 </if>
1115
1116 <OnDependency>
1117 <sourcefiles>
1118 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
1119 </sourcefiles>
1120 <targetfiles>
1121 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
1122 </targetfiles>
1123
1124 <sequential>
1125 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
1126 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
1127 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
1128 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
1129 sectiontype="EFI_SECTION_PE32"/>
1130
1131 <POST.PROCESS/>
1132 </sequential>
1133 </OnDependency>
1134 </sequential>
1135 </macrodef>
1136
1137 <!--
1138 EFI_SECTION_VERSION
1139 -->
1140 <macrodef name="EFI_SECTION_VERSION">
1141 <attribute name="FILEPATH"/>
1142 <attribute name="FILENAME"/>
1143 <attribute name="FILEEXT" default="" />
1144 <attribute name="VERSION" default="0000"/>
1145
1146 <element name="PRE.PROCESS" optional="yes"/>
1147 <element name="POST.PROCESS" optional="yes"/>
1148
1149 <sequential>
1150 <if>
1151 <not>
1152 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
1153 </not>
1154
1155 <then>
1156 <PRE.PROCESS/>
1157 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
1158 versionnum="@{VERSION}"
1159 sectiontype="EFI_SECTION_VERSION"/>
1160 <POST.PROCESS/>
1161 </then>
1162 </if>
1163 </sequential>
1164 </macrodef>
1165
1166 <!--
1167 EFI_SECTION_USER_INTERFACE
1168 -->
1169 <macrodef name="EFI_SECTION_USER_INTERFACE">
1170 <attribute name="FILEPATH"/>
1171 <attribute name="FILENAME"/>
1172 <attribute name="FILEEXT" default="" />
1173 <attribute name="UI" default="${BASE_NAME}"/>
1174
1175 <element name="PRE.PROCESS" optional="yes"/>
1176 <element name="POST.PROCESS" optional="yes"/>
1177
1178 <sequential>
1179 <if>
1180 <not>
1181 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
1182 </not>
1183
1184 <then>
1185 <PRE.PROCESS/>
1186 <gensection interfacestring="@{UI}"
1187 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
1188 sectiontype="EFI_SECTION_USER_INTERFACE"/>
1189 <POST.PROCESS/>
1190 </then>
1191 </if>
1192 </sequential>
1193 </macrodef>
1194
1195 <!--
1196 EFI_SECTION_DXE_DEPEX
1197 -->
1198 <macrodef name="EFI_SECTION_DXE_DEPEX">
1199 <attribute name="FILEPATH"/>
1200 <attribute name="FILENAME"/>
1201 <attribute name="FILEEXT" default="dxs"/>
1202
1203 <element name="PRE.PROCESS" optional="yes"/>
1204 <element name="POST.PROCESS" optional="yes"/>
1205
1206 <sequential>
1207 <PRE.PROCESS/>
1208
1209 <if>
1210 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1211 <then>
1212 <OnDependency>
1213 <sourcefiles>
1214 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1215 </sourcefiles>
1216 <targetfiles>
1217 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1218 </targetfiles>
1219 <sequential>
1220 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1221 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1222 sectiontype="EFI_SECTION_DXE_DEPEX"/>
1223 </sequential>
1224 </OnDependency>
1225 </then>
1226 <else>
1227 <if>
1228 <not>
1229 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1230 </not>
1231 <then>
1232 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1233 </then>
1234 </if>
1235 </else>
1236 </if>
1237
1238 <POST.PROCESS/>
1239 </sequential>
1240 </macrodef>
1241
1242 <!--
1243 EFI_SECTION_PEI_DEPEX
1244 -->
1245 <macrodef name="EFI_SECTION_PEI_DEPEX">
1246 <attribute name="FILEPATH"/>
1247 <attribute name="FILENAME"/>
1248 <attribute name="FILEEXT" default="dxs"/>
1249
1250 <element name="PRE.PROCESS" optional="yes"/>
1251 <element name="POST.PROCESS" optional="yes"/>
1252 <sequential>
1253 <PRE.PROCESS/>
1254 <if>
1255 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1256 <then>
1257 <OnDependency>
1258 <sourcefiles>
1259 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
1260 </sourcefiles>
1261 <targetfiles>
1262 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1263 </targetfiles>
1264
1265 <sequential>
1266 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
1267 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
1268 sectiontype="EFI_SECTION_PEI_DEPEX"/>
1269 </sequential>
1270 </OnDependency>
1271
1272 </then>
1273 <else>
1274 <if>
1275 <not>
1276 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1277 </not>
1278 <then>
1279 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
1280 </then>
1281 </if>
1282 </else>
1283 </if>
1284 <POST.PROCESS/>
1285 </sequential>
1286 </macrodef>
1287
1288
1289 <!--
1290 EFI_SECTION_RAW
1291 -->
1292 <macrodef name="EFI_SECTION_RAW">
1293 <attribute name="FILEPATH"/>
1294 <attribute name="FILENAME"/>
1295 <attribute name="FILEEXT" default="bin"/>
1296
1297 <element name="PRE.PROCESS" optional="yes"/>
1298 <element name="POST.PROCESS" optional="yes"/>
1299
1300 <sequential>
1301 <OnDependency>
1302 <sourcefiles>
1303 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1304 </sourcefiles>
1305 <targetfiles>
1306 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1307 </targetfiles>
1308
1309 <sequential>
1310 <PRE.PROCESS/>
1311 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1312 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1313 sectiontype="EFI_SECTION_RAW"/>
1314 <POST.PROCESS/>
1315 </sequential>
1316 </OnDependency>
1317 </sequential>
1318 </macrodef>
1319
1320 <!--
1321 EFI_SECTION_RAW_SEC
1322 -->
1323 <macrodef name="EFI_SECTION_RAW_SEC">
1324 <attribute name="FILEPATH"/>
1325 <attribute name="FILENAME"/>
1326 <attribute name="FILEEXT" default="cat"/>
1327
1328 <element name="PRE.PROCESS" optional="yes"/>
1329 <element name="POST.PROCESS" optional="yes"/>
1330
1331 <sequential>
1332 <OnDependency>
1333 <sourcefiles>
1334 <file name="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"/>
1335 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.te"/>
1336 </sourcefiles>
1337 <targetfiles>
1338 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
1339 </targetfiles>
1340
1341 <sequential>
1342 <PRE.PROCESS/>
1343 <secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"
1344 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>
1345
1346 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"
1347 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
1348 sectiontype="EFI_SECTION_RAW"/>
1349 <POST.PROCESS/>
1350 </sequential>
1351 </OnDependency>
1352 </sequential>
1353 </macrodef>
1354
1355 <!--
1356 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1357 -->
1358 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
1359 <attribute name="FILEPATH"/>
1360 <attribute name="FILENAME"/>
1361 <attribute name="FILEEXT" default="fv"/>
1362
1363 <element name="PRE.PROCESS" optional="yes"/>
1364 <element name="POST.PROCESS" optional="yes"/>
1365
1366 <sequential>
1367 <OnDependency>
1368 <sourcefiles>
1369 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1370 </sourcefiles>
1371 <targetfiles>
1372 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
1373 </targetfiles>
1374
1375 <sequential>
1376 <PRE.PROCESS/>
1377
1378 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1379 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1380 overwrite="true"/>
1381 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1382 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
1383 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
1384
1385 <POST.PROCESS/>
1386 </sequential>
1387 </OnDependency>
1388 </sequential>
1389 </macrodef>
1390
1391 <!--
1392 Binary
1393 -->
1394 <macrodef name="Build_Binary">
1395 <attribute name="FILEPATH"/>
1396 <attribute name="FILENAME"/>
1397 <attribute name="FILEEXT" default="bin"/>
1398
1399 <element name="EXTRA.INC" optional="yes"/>
1400 <element name="EXTRA.ARG" optional="yes"/>
1401
1402 <sequential>
1403 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1404 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1405 </sequential>
1406 </macrodef>
1407
1408 <!--
1409 Microcode
1410 -->
1411 <macrodef name="Build_MICROCODE">
1412 <attribute name="FILEPATH"/>
1413 <attribute name="FILENAME"/>
1414 <attribute name="FILEEXT" default="TXT"/>
1415
1416 <element name="EXTRA.INC" optional="yes"/>
1417 <element name="EXTRA.ARG" optional="yes"/>
1418
1419 <sequential>
1420 <mkdir dir="${TARGET_DIR}/Microcode"/>
1421 <flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
1422 </sequential>
1423 </macrodef>
1424
1425 <!--
1426 Graphics (bmp, ...)
1427 -->
1428 <macrodef name="Build_BMP">
1429 <attribute name="FILEPATH"/>
1430 <attribute name="FILENAME"/>
1431 <attribute name="FILEEXT" default="bmp"/>
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 build EFI file
1444 -->
1445 <macrodef name="Build_EFI">
1446 <attribute name="FILEPATH"/>
1447 <attribute name="FILENAME"/>
1448 <attribute name="FILEEXT" default="efi"/>
1449
1450 <element name="EXTRA.INC" optional="yes"/>
1451 <element name="EXTRA.ARG" optional="yes"/>
1452
1453 <sequential>
1454 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1455 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1456 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1457 </sequential>
1458 </macrodef>
1459
1460 <!--
1461 Build macro for Apriori
1462 -->
1463 <macrodef name="Build_Apriori">
1464 <attribute name="FILEPATH" default="."/>
1465 <attribute name="FILENAME"/>
1466 <attribute name="FILEEXT" default="apr"/>
1467 <attribute name="GUID"/>
1468
1469 <sequential>
1470 <mkdir dir="${FV_DIR}/Apriori" />
1471 <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1472 outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
1473 sectiontype="EFI_SECTION_RAW"/>
1474
1475 <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
1476 fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
1477 <sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
1478 </genffsfile>
1479
1480 </sequential>
1481 </macrodef>
1482 </project>