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