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