a59988aae1c814d018a63e228cc219ca85a131d3
[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 definitions for building files with different types
15 -->
16 <!--
17 C Code
18 -->
19 <macrodef name="Build_CCode">
20 <attribute name="FILEPATH"/>
21 <attribute name="FILENAME"/>
22 <attribute name="FILEEXT" default="c"/>
23
24 <element name="EXTRA.INC" optional="yes"/>
25 <element name="EXTRA.ARG" optional="yes"/>
26
27 <sequential>
28 <var name="FILE_BASENAME" value="@{FILENAME}" />
29 <var name="FILE_PATH" value="@{FILEPATH}" />
30 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
31
32 <if>
33 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
34 <then>
35 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
36 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
37 <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
38 <EXTRA.INC/>
39 </makedeps>
40 </then>
41 </if>
42
43 <OnDependency>
44 <sourcefiles>
45 <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
46 </sourcefiles>
47 <targetfiles>
48 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
49 </targetfiles>
50
51 <sequential>
52 <cc userdefine="on">
53 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
54 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
55 <EXTRA.INC/>
56 <argument value="${CC_FLAGS}"/>
57 <EXTRA.ARG/>
58 <fileset casesensitive="off" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
59 </command>
60 </cc>
61 </sequential>
62 </OnDependency>
63 </sequential>
64 </macrodef>
65
66
67 <macrodef name="Build_AUTOGEN">
68 <attribute name="FILEPATH"/>
69 <attribute name="FILENAME"/>
70 <attribute name="FILEEXT" default="c"/>
71
72 <element name="EXTRA.INC" optional="yes"/>
73 <element name="EXTRA.ARG" optional="yes"/>
74
75 <sequential>
76 <var name="FILE_BASENAME" value="@{FILENAME}" />
77 <var name="FILE_PATH" value="@{FILEPATH}" />
78 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
79
80 <if>
81 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
82 <then>
83 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
84 <input file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
85 <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
86 <EXTRA.INC/>
87 </makedeps>
88 </then>
89 </if>
90
91 <OnDependency>
92 <sourcefiles>
93 <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
94 </sourcefiles>
95 <targetfiles>
96 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
97 </targetfiles>
98
99 <sequential>
100 <cc userdefine="on">
101 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
102 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
103 <EXTRA.INC/>
104 <argument value="${CC_FLAGS}"/>
105 <EXTRA.ARG/>
106 <fileset casesensitive="off" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
107 </command>
108 </cc>
109 </sequential>
110 </OnDependency>
111 </sequential>
112 </macrodef>
113
114 <macrodef name="Build_DPX">
115 <attribute name="FILEPATH"/>
116 <attribute name="FILENAME"/>
117 <attribute name="FILEEXT" default="dxs"/>
118
119 <element name="EXTRA.INC" optional="yes"/>
120 <element name="EXTRA.ARG" optional="yes"/>
121
122
123 <sequential>
124 <var name="FILE_BASENAME" value="@{FILENAME}" />
125 <var name="FILE_PATH" value="@{FILEPATH}" />
126 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
127
128 <OnDependency>
129 <sourcefiles>
130 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
131 </sourcefiles>
132 <targetfiles>
133 <file name="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
134 </targetfiles>
135
136 <sequential>
137 <cc userdefine="on">
138 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${CC_FAMILY}"
139 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">
140 <EXTRA.INC/>
141 <argument value="${PP_FLAGS}"/>
142 <fileset casesensitive="off" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
143 </command>
144 </cc>
145
146 <gendepex inputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" outputFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>
147 </sequential>
148 </OnDependency>
149 </sequential>
150 </macrodef>
151
152 <macrodef name="Build_ASM">
153 <attribute name="FILEPATH"/>
154 <attribute name="FILENAME"/>
155 <attribute name="FILEEXT" default="asm"/>
156
157 <element name="EXTRA.INC" optional="yes"/>
158 <element name="EXTRA.ARG" optional="yes"/>
159
160 <!-- Dispath ASM file, there are three type.
161 asm - Build_Assembly
162 S - Build_Gcc_Assembly
163 s - Build_Ipf_Assembly -->
164 <sequential>
165 <if>
166 <equals arg1="@{FILEEXT}" arg2="asm" />
167 <then>
168 <Build_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
169 <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
170 <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
171 </Build_Assembly>
172 </then>
173 <elseif>
174 <equals arg1="@{FILEEXT}" arg2="S" />
175 <then>
176 <Build_Gcc_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
177 <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
178 <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
179 </Build_Gcc_Assembly>
180 </then>
181 </elseif>
182 <elseif>
183 <equals arg1="@{FILEEXT}" arg2="s" />
184 <then>
185 <Build_IPF_Assembly_Code FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">
186 <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>
187 <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>
188 </Build_IPF_Assembly_Code>
189 </then>
190 </elseif>
191 </if>
192 </sequential>
193 </macrodef>
194
195 <!--
196 IA32/x64 Assembly
197 -->
198 <macrodef name="Build_Assembly">
199 <attribute name="FILEPATH"/>
200 <attribute name="FILENAME"/>
201 <attribute name="FILEEXT" default="asm"/>
202
203 <element name="EXTRA.INC.1" optional="yes"/>
204 <element name="EXTRA.ARG.1" optional="yes"/>
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}/@{FILEPATH}/@{FILENAME}.obj"/>
217 </targetfiles>
218
219 <sequential>
220 <cc userdefine="on">
221 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}">
222 <EXTRA.INC.1/>
223 <argument value="${PP_FLAGS}"/>
224 <fileset casesensitive="off" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
225 </command>
226 </cc>
227
228 <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
229 match="^(#line +1 +.*@{FILEPATH}/@{FILENAME}\.@{FILEEXT}&quot;).+\1"
230 replace=";"
231 flags="gs"/>
232 <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
233 match="^(#line .*)$"
234 replace="; \1"
235 byline="true"/>
236 <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"
237 match="([^_a-zA-Z])0x([0-9a-fA-F]+)"
238 replace="\10\2h"
239 flags="g"
240 byline="true"/>
241
242 <cc userdefine="on">
243 <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
244 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
245 <EXTRA.INC.1/>
246
247 <argument value="${ASM_FLAGS}"/>
248 <EXTRA.ARG.1/>
249
250 <fileset casesensitive="off" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
251 </command>
252 </cc>
253 </sequential>
254 </OnDependency>
255 </sequential>
256 </macrodef>
257
258 <!--
259 Build GCC assembly code
260 -->
261 <macrodef name="Build_Gcc_Assembly">
262 <attribute name="FILEPATH"/>
263 <attribute name="FILENAME"/>
264 <attribute name="FILEEXT" default="asm"/>
265
266 <element name="EXTRA.INC.1" optional="yes"/>
267 <element name="EXTRA.ARG.1" optional="yes"/>
268
269 <sequential>
270 <var name="FILE_BASENAME" value="@{FILENAME}" />
271 <var name="FILE_PATH" value="@{FILEPATH}" />
272 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
273
274 <OnDependency>
275 <sourcefiles>
276 <file Name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
277 </sourcefiles>
278 <targetfiles>
279 <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
280 </targetfiles>
281
282 <sequential>
283 <cc userdefine="on">
284 <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
285 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
286 <EXTRA.INC.1/>
287
288 <argument value="${ASM_FLAGS}"/>
289 <EXTRA.ARG.1/>
290
291 <fileset casesensitive="off" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
292 </command>
293 </cc>
294 </sequential>
295 </OnDependency>
296 </sequential>
297 </macrodef>
298
299 <!--
300 IPF Assembly
301 -->
302 <macrodef name="Build_IPF_Assembly_Code">
303 <attribute name="FILEPATH"/>
304 <attribute name="FILENAME"/>
305 <attribute name="FILEEXT" default="s"/>
306
307 <element name="EXTRA.INC.1" optional="yes"/>
308 <element name="EXTRA.ARG.1" optional="yes"/>
309
310 <sequential>
311 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
312
313 <if>
314 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
315 <then>
316 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
317 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
318 <EXTRA.INC.1/>
319 </makedeps>
320 </then>
321 </if>
322
323 <OnDependency>
324 <sourcefiles>
325 <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
326 </sourcefiles>
327 <targetfiles>
328 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
329 </targetfiles>
330
331 <sequential>
332 <cc userdefine="on">
333 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}">
334 <EXTRA.INC.1/>
335 <argument value="${PP_FLAGS}"/>
336 <fileset casesensitive="off" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
337 </command>
338 </cc>
339
340 <cc userdefine="on">
341 <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"
342 includepathDelimiter="-I" outputDelimiter="-o"
343 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
344 <EXTRA.INC.1/>
345 <argument value="${ASM_FLAGS}"/>
346 <EXTRA.ARG.1/>
347 <fileset casesensitive="off" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>
348 </command>
349 </cc>
350 </sequential>
351 </OnDependency>
352 </sequential>
353 </macrodef>
354
355
356 <macrodef name="Build_IPF_PP_Code">
357 <attribute name="FILEPATH"/>
358 <attribute name="FILENAME"/>
359 <attribute name="FILEEXT" default="i"/>
360
361 <element name="EXTRA.INC" optional="yes"/>
362 <element name="EXTRA.ARG" optional="yes"/>
363
364 <sequential>
365 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
366
367 <cc userdefine="on">
368 <command type="ASM" includepathDelimiter="-I">
369 <includepath path="${WORKSPACE_DIR}"/>
370 <includepath path="${MODULE_DIR}"/>
371 <includepath path="${MODULE_DIR}/${ARCH}"/>
372 <EXTRA.INC/>
373
374 <argument value="${ASM_FLAGS}"/>
375 <EXTRA.ARG/>
376 <OutputFile File="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
377
378 <fileset casesensitive="off" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
379 </command>
380 </cc>
381 </sequential>
382 </macrodef>
383
384
385 <!--
386 Library private HashMap map = new HashMap();
387 -->
388 <macrodef name="Build_Library">
389 <attribute name="FILENAME" />
390 <attribute name="FILEEXT" default="obj"/>
391
392 <sequential>
393 <var name="FILE_BASENAME" value="@{FILENAME}" />
394 <var name="FILE_PATH" value="." />
395 <mkdir dir="${BIN_DIR}"/>
396
397 <OnDependency>
398 <sourcefiles>
399 <file list="${OBJECTS}"/>
400 </sourcefiles>
401 <targetfiles>
402 <file name="${BIN_DIR}/@{FILENAME}.lib"/>
403 </targetfiles>
404
405 <sequential>
406 <cc userdefine="on">
407 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
408 outputFile="${BIN_DIR}/@{FILENAME}.lib">
409 <argument value="${SLINK_FLAGS}"/>
410
411 <fileset casesensitive="off" dir="${DEST_DIR_OUTPUT}" includes="**/*.obj"/>
412 </command>
413 </cc>
414 </sequential>
415 </OnDependency>
416 </sequential>
417 </macrodef>
418
419 <!--
420 Unicode -> .sdb
421 -->
422 <macrodef name="Build_UNI">
423 <attribute name="FILEPATH"/>
424 <attribute name="FILENAME"/>
425 <attribute name="FILEEXT" default="uni"/>
426
427 <element name="EXTRA.INC" optional="yes"/>
428 <element name="EXTRA.ARG" optional="yes"/>
429
430 <sequential>
431 <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
432
433 <OnDependency>
434 <sourcefiles>
435 <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
436 </sourcefiles>
437 <targetfiles>
438 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
439 </targetfiles>
440
441 <sequential>
442 <strgather commandtype="parse" newdatabase="true">
443 <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
444 <EXTRA.INC/>
445 <EXTRA.ARG/>
446 <inputfile name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
447 </strgather>
448 </sequential>
449 </OnDependency>
450
451 <var name="SDB_FILES" value="${SDB_FILES}, ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
452 </sequential>
453 </macrodef>
454
455 <!--
456 .sdb(s) -> .c, .h -> .obj
457 -->
458 <macrodef name="Build_Unicode_Database">
459 <attribute name="FILEPATH"/>
460 <attribute name="FILENAME"/>
461 <attribute name="FILEEXT" default="sdb"/>
462
463 <element name="EXTRA.INC" optional="yes"/>
464 <element name="EXTRA.ARG" optional="yes"/>
465
466 <sequential>
467 <var name="FILE_BASENAME" value="@{FILENAME}" />
468 <var name="FILE_PATH" value="@{FILEPATH}" />
469 <OnDependency>
470 <sourcefiles>
471 <file list="${SDB_FILES}"/>
472 <file list="${SOURCE_FILES}"/>
473 </sourcefiles>
474 <targetfiles>
475 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
476 </targetfiles>
477
478 <sequential>
479 <strgather commandtype="scan" outputdatabase="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb" verbose="read">
480 <skipext name=".uni"/>
481 <skipext name=".h"/>
482 <database list="${SDB_FILES}"/>
483 <inputfile name="${SOURCE_FILES}"/>
484 </strgather>
485 </sequential>
486 </OnDependency>
487
488 <OnDependency>
489 <sourcefiles>
490 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
491 </sourcefiles>
492 <targetfiles>
493 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"/>
494 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"/>
495 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
496 </targetfiles>
497
498 <sequential>
499 <strgather basename="@{FILENAME}Strings" commandtype="dump"
500 outputdefines="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"
501 outputhpk="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"
502 outputstring="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c">
503 <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
504 </strgather>
505 </sequential>
506 </OnDependency>
507
508 <OnDependency>
509 <sourcefiles>
510 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
511 </sourcefiles>
512 <targetfiles>
513 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj"/>
514 </targetfiles>
515
516 <sequential>
517 <cc userdefine="on">
518 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"
519 includepathDelimiter="-I"
520 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">
521 <argument value="${CC_FLAGS}"/>
522 <EXTRA.INC />
523 <fileset casesensitive="off" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>
524 </command>
525 </cc>
526 </sequential>
527 </OnDependency>
528
529 </sequential>
530 </macrodef>
531
532 <!--
533 Vfr
534 -->
535 <macrodef name="Build_VFR">
536 <attribute name="FILEPATH"/>
537 <attribute name="FILENAME"/>
538 <attribute name="FILEEXT" default="vfr"/>
539
540 <element name="EXTRA.INC" optional="yes"/>
541 <element name="EXTRA.ARG" optional="yes"/>
542
543 <sequential>
544 <mkdir dir="${DEST_DIR_DEBUG}/@{FILEPATH}"/>
545
546 <if>
547 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
548 <then>
549 <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
550 <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
551 <EXTRA.INC/>
552 </makedeps>
553 </then>
554 </if>
555
556 <OnDependency>
557 <sourcefiles>
558 <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
559 </sourcefiles>
560 <targetfiles>
561 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
562 </targetfiles>
563
564 <sequential>
565 <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}">
566 <EXTRA.INC/>
567 </vfrcompile>
568
569 <cc userdefine="on">
570 <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}"
571 includepathDelimiter="-I" family="${CC_FAMILY}"
572 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >
573 <argument value="${CC_FLAGS}"/>
574 <EXTRA.INC/>
575 <EXTRA.ARG/>
576 <fileset casesensitive="off" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.c"/>
577 </command>
578 </cc>
579 <delete file="${PLATFORM_DIR}/@{FILENAME}.i" />
580 </sequential>
581 </OnDependency>
582 </sequential>
583 </macrodef>
584
585 <!--############################################################################
586 Build Sections
587 #############################################################################-->
588 <!--
589 DLL
590 -->
591 <macrodef name="GenDll">
592 <attribute name="FILEPATH"/>
593 <attribute name="FILENAME"/>
594 <attribute name="FILEEXT"/>
595
596 <element name="LIB.ARG" optional="yes"/>
597 <element name="LINK.ARG" optional="yes"/>
598
599 <sequential>
600 <var name="FILE_BASENAME" value="@{FILENAME}" />
601 <var name="FILE_PATH" value="@{FILEPATH}" />
602 <OnDependency>
603 <sourcefiles>
604 <file list="${LIBS}"/>
605 </sourcefiles>
606 <targetfiles>
607 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
608 </targetfiles>
609
610 <sequential>
611 <cc userdefine="on">
612 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
613 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib">
614 <argument value="${SLINK_FLAGS}"/>
615
616 <fileset casesensitive="off" dir="${DEST_DIR_OUTPUT}" includes="**/*.obj"/>
617 </command>
618 </cc>
619 <cc userdefine="on">
620 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
621 outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" >
622 <argument value="${DLINK_FLAGS}"/>
623 <libset libs="${LIBS}"/>
624 <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"/>
625 <libset libs="${DLINK_SPATH}" />
626 <LINK.ARG/>
627 </command>
628 </cc>
629 </sequential>
630 </OnDependency>
631 </sequential>
632 </macrodef>
633
634 <!--
635 EFI
636 -->
637 <macrodef name="GenEfi">
638 <attribute name="FILEPATH"/>
639 <attribute name="FILENAME"/>
640 <attribute name="FILEEXT" default="dll"/>
641
642 <sequential>
643 <OnDependency>
644 <sourcefiles>
645 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
646 </sourcefiles>
647 <targetfiles>
648 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
649 </targetfiles>
650
651 <sequential>
652 <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
653 peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
654 </sequential>
655 </OnDependency>
656 </sequential>
657 </macrodef>
658
659 <!--
660 EFI_SECTION_FREEFORM_SUBTYPE_GUID
661 EFI_SECTION_VERSION
662 EFI_SECTION_USER_INTERFACE
663 EFI_SECTION_DXE_DEPEX
664 EFI_SECTION_PEI_DEPEX
665 EFI_SECTION_PE32
666 EFI_SECTION_PIC
667 EFI_SECTION_TE
668 EFI_SECTION_RAW
669 EFI_SECTION_COMPRESSION
670 EFI_SECTION_GUID_DEFINED
671 EFI_SECTION_COMPATIBILITY16
672 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
673 -->
674 <!--
675 EFI_SECTION_PE32
676 -->
677
678 <macrodef name="EFI_SECTION_TE">
679 <attribute name="FILEPATH"/>
680 <attribute name="FILENAME"/>
681 <attribute name="FILEEXT" default="" />
682
683 <element name="PRE.PROCESS" optional="yes"/>
684 <element name="POST.PROCESS" optional="yes"/>
685
686 <sequential>
687 <PRE.PROCESS/>
688 <if>
689 <not>
690 <equals arg1="${LIBS}" arg2=""/>
691 </not>
692
693 <then>
694 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
695 <LIB.ARG></LIB.ARG>
696 <LINK.ARG></LINK.ARG>
697 </GenDll>
698
699 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
700 </then>
701 </if>
702
703 <OnDependency>
704 <sourcefiles>
705 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
706 </sourcefiles>
707 <targetfiles>
708 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
709 </targetfiles>
710
711 <sequential>
712 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
713 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
714 <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
715 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.te" tofile="${BIN_DIR}/@{FILENAME}.te" />
716 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
717 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
718 sectiontype="EFI_SECTION_TE"/>
719 <POST.PROCESS/>
720 </sequential>
721 </OnDependency>
722 </sequential>
723 </macrodef>
724
725 <macrodef name="EFI_SECTION_PE32">
726 <attribute name="FILEPATH"/>
727 <attribute name="FILENAME"/>
728 <attribute name="FILEEXT" default="" />
729
730 <element name="PRE.PROCESS" optional="yes"/>
731 <element name="POST.PROCESS" optional="yes"/>
732
733 <sequential>
734 <PRE.PROCESS/>
735 <if>
736 <not>
737 <!-- TBD ${OBJECTS} -->
738 <equals arg1="${LIBS}" arg2=""/>
739 </not>
740
741 <then>
742 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
743 <LIB.ARG></LIB.ARG>
744 <LINK.ARG></LINK.ARG>
745 </GenDll>
746
747 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
748 </then>
749 </if>
750
751 <OnDependency>
752 <sourcefiles>
753 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
754 </sourcefiles>
755 <targetfiles>
756 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
757 </targetfiles>
758
759 <sequential>
760 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
761
762 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
763 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
764 sectiontype="EFI_SECTION_PE32"/>
765
766 <POST.PROCESS/>
767 </sequential>
768 </OnDependency>
769 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
770 </sequential>
771 </macrodef>
772
773 <!--
774 EFI_SECTION_VERSION
775 -->
776 <macrodef name="EFI_SECTION_VERSION">
777 <attribute name="FILEPATH"/>
778 <attribute name="FILENAME"/>
779 <attribute name="FILEEXT" default="" />
780 <attribute name="VERSION" default="0000"/>
781
782 <element name="PRE.PROCESS" optional="yes"/>
783 <element name="POST.PROCESS" optional="yes"/>
784
785 <sequential>
786 <if>
787 <not>
788 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
789 </not>
790
791 <then>
792 <PRE.PROCESS/>
793 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
794 versionnum="@{VERSION}"
795 sectiontype="EFI_SECTION_VERSION"/>
796 <POST.PROCESS/>
797 </then>
798 </if>
799 </sequential>
800 </macrodef>
801
802 <!--
803 EFI_SECTION_USER_INTERFACE
804 -->
805 <macrodef name="EFI_SECTION_USER_INTERFACE">
806 <attribute name="FILEPATH"/>
807 <attribute name="FILENAME"/>
808 <attribute name="FILEEXT" default="" />
809 <attribute name="UI" default="${BASE_NAME}"/>
810
811 <element name="PRE.PROCESS" optional="yes"/>
812 <element name="POST.PROCESS" optional="yes"/>
813
814 <sequential>
815 <if>
816 <not>
817 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
818 </not>
819
820 <then>
821 <PRE.PROCESS/>
822 <gensection interfacestring="@{UI}"
823 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
824 sectiontype="EFI_SECTION_USER_INTERFACE"/>
825 <POST.PROCESS/>
826 </then>
827 </if>
828 </sequential>
829 </macrodef>
830
831 <!--
832 EFI_SECTION_DXE_DEPEX
833 -->
834 <macrodef name="EFI_SECTION_DXE_DEPEX">
835 <attribute name="FILEPATH"/>
836 <attribute name="FILENAME"/>
837 <attribute name="FILEEXT" default="dxs"/>
838
839 <element name="PRE.PROCESS" optional="yes"/>
840 <element name="POST.PROCESS" optional="yes"/>
841
842 <sequential>
843 <PRE.PROCESS/>
844
845 <if>
846 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
847 <then>
848 <OnDependency>
849 <sourcefiles>
850 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
851 </sourcefiles>
852 <targetfiles>
853 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
854 </targetfiles>
855 <sequential>
856 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
857 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
858 sectiontype="EFI_SECTION_DXE_DEPEX"/>
859 </sequential>
860 </OnDependency>
861 </then>
862 <else>
863 <if>
864 <not>
865 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
866 </not>
867 <then>
868 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
869 </then>
870 </if>
871 </else>
872 </if>
873
874 <POST.PROCESS/>
875 </sequential>
876 </macrodef>
877
878 <!--
879 EFI_SECTION_PEI_DEPEX
880 -->
881 <macrodef name="EFI_SECTION_PEI_DEPEX">
882 <attribute name="FILEPATH"/>
883 <attribute name="FILENAME"/>
884 <attribute name="FILEEXT" default="dxs"/>
885
886 <element name="PRE.PROCESS" optional="yes"/>
887 <element name="POST.PROCESS" optional="yes"/>
888 <sequential>
889 <PRE.PROCESS/>
890 <if>
891 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
892 <then>
893 <OnDependency>
894 <sourcefiles>
895 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
896 </sourcefiles>
897 <targetfiles>
898 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
899 </targetfiles>
900
901 <sequential>
902 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
903 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
904 sectiontype="EFI_SECTION_PEI_DEPEX"/>
905 </sequential>
906 </OnDependency>
907
908 </then>
909 <else>
910 <if>
911 <not>
912 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
913 </not>
914 <then>
915 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
916 </then>
917 </if>
918 </else>
919 </if>
920 <POST.PROCESS/>
921 </sequential>
922 </macrodef>
923
924
925 <!--
926 EFI_SECTION_RAW
927 -->
928 <macrodef name="EFI_SECTION_RAW">
929 <attribute name="FILEPATH"/>
930 <attribute name="FILENAME"/>
931 <attribute name="FILEEXT" default="bin"/>
932
933 <element name="PRE.PROCESS" optional="yes"/>
934 <element name="POST.PROCESS" optional="yes"/>
935
936 <sequential>
937 <OnDependency>
938 <sourcefiles>
939 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"/>
940 </sourcefiles>
941 <targetfiles>
942 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
943 </targetfiles>
944
945 <sequential>
946 <PRE.PROCESS/>
947 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"
948 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
949 sectiontype="EFI_SECTION_RAW"/>
950 <POST.PROCESS/>
951 </sequential>
952 </OnDependency>
953 </sequential>
954 </macrodef>
955
956 <!--
957 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
958 -->
959 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
960 <attribute name="FILEPATH"/>
961 <attribute name="FILENAME"/>
962 <attribute name="FILEEXT" default="fv"/>
963
964 <element name="PRE.PROCESS" optional="yes"/>
965 <element name="POST.PROCESS" optional="yes"/>
966
967 <sequential>
968 <OnDependency>
969 <sourcefiles>
970 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
971 </sourcefiles>
972 <targetfiles>
973 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
974 </targetfiles>
975
976 <sequential>
977 <PRE.PROCESS/>
978
979 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
980 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
981 overwrite="true"/>
982 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
983 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
984 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
985
986 <POST.PROCESS/>
987 </sequential>
988 </OnDependency>
989 </sequential>
990 </macrodef>
991
992 <!--
993 Binary
994 -->
995 <macrodef name="Build_Binary">
996 <attribute name="FILEPATH"/>
997 <attribute name="FILENAME"/>
998 <attribute name="FILEEXT" default="bin"/>
999
1000 <element name="EXTRA.INC" optional="yes"/>
1001 <element name="EXTRA.ARG" optional="yes"/>
1002
1003 <sequential>
1004 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1005 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1006 </sequential>
1007 </macrodef>
1008
1009 <!--
1010 Graphics (bmp, ...)
1011 -->
1012 <macrodef name="Build_Graphics">
1013 <attribute name="FILEPATH"/>
1014 <attribute name="FILENAME"/>
1015 <attribute name="FILEEXT" default="bmp"/>
1016
1017 <element name="EXTRA.INC" optional="yes"/>
1018 <element name="EXTRA.ARG" optional="yes"/>
1019
1020 <sequential>
1021 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1022 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1023 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1024 </sequential>
1025 </macrodef>
1026 <macrodef name="Build_EFI">
1027 <attribute name="FILEPATH"/>
1028 <attribute name="FILENAME"/>
1029 <attribute name="FILEEXT" default="efi"/>
1030
1031 <element name="EXTRA.INC" optional="yes"/>
1032 <element name="EXTRA.ARG" optional="yes"/>
1033
1034 <sequential>
1035 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1036 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1037 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1038 </sequential>
1039 </macrodef>
1040 </project>