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