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