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