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