Corrected the dependency check issue for Build_Library and GenDll macros.
[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 <fileset casesensitive="off" dir="${DEST_DIR_OUTPUT}" includes="**/*.obj"/>
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 DUMMY
587 -->
588 <macrodef name="Build_DUMMY">
589 <attribute name="FILEPATH"/>
590 <attribute name="FILENAME"/>
591 <attribute name="FILEEXT"/>
592
593 <element name="EXTRA.INC" optional="yes"/>
594 <element name="EXTRA.ARG" optional="yes"/>
595
596 <sequential>
597 <echo message="Ignore DUMMY file ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
598 </sequential>
599 </macrodef>
600
601 <!--############################################################################
602 Build Sections
603 #############################################################################-->
604 <!--
605 DLL
606 -->
607 <macrodef name="GenDll">
608 <attribute name="FILEPATH"/>
609 <attribute name="FILENAME"/>
610 <attribute name="FILEEXT"/>
611
612 <element name="LIB.ARG" optional="yes"/>
613 <element name="LINK.ARG" optional="yes"/>
614
615 <sequential>
616 <var name="FILE_BASENAME" value="@{FILENAME}" />
617 <var name="FILE_PATH" value="@{FILEPATH}" />
618 <OnDependency>
619 <sourcefiles>
620 <file list="${LIBS}"/>
621 <fileset casesensitive="off" dir="${DEST_DIR_OUTPUT}" includes="**/*.obj"/>
622 </sourcefiles>
623 <targetfiles>
624 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
625 </targetfiles>
626
627 <sequential>
628 <cc userdefine="on">
629 <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"
630 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib">
631 <argument value="${SLINK_FLAGS}"/>
632
633 <fileset casesensitive="off" dir="${DEST_DIR_OUTPUT}" includes="**/*.obj"/>
634 </command>
635 </cc>
636 <cc userdefine="on">
637 <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
638 outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" >
639 <argument value="${DLINK_FLAGS}"/>
640 <libset libs="${LIBS}"/>
641 <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"/>
642 <libset libs="${DLINK_SPATH}" />
643 <LINK.ARG/>
644 </command>
645 </cc>
646 </sequential>
647 </OnDependency>
648 </sequential>
649 </macrodef>
650
651 <!--
652 EFI
653 -->
654 <macrodef name="GenEfi">
655 <attribute name="FILEPATH"/>
656 <attribute name="FILENAME"/>
657 <attribute name="FILEEXT" default="dll"/>
658
659 <sequential>
660 <OnDependency>
661 <sourcefiles>
662 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
663 </sourcefiles>
664 <targetfiles>
665 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
666 </targetfiles>
667
668 <sequential>
669 <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
670 peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
671 </sequential>
672 </OnDependency>
673 </sequential>
674 </macrodef>
675
676 <!--
677 EFI_SECTION_FREEFORM_SUBTYPE_GUID
678 EFI_SECTION_VERSION
679 EFI_SECTION_USER_INTERFACE
680 EFI_SECTION_DXE_DEPEX
681 EFI_SECTION_PEI_DEPEX
682 EFI_SECTION_PE32
683 EFI_SECTION_PIC
684 EFI_SECTION_TE
685 EFI_SECTION_RAW
686 EFI_SECTION_COMPRESSION
687 EFI_SECTION_GUID_DEFINED
688 EFI_SECTION_COMPATIBILITY16
689 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
690 -->
691 <!--
692 EFI_SECTION_PE32
693 -->
694
695 <macrodef name="EFI_SECTION_TE">
696 <attribute name="FILEPATH"/>
697 <attribute name="FILENAME"/>
698 <attribute name="FILEEXT" default="" />
699
700 <element name="PRE.PROCESS" optional="yes"/>
701 <element name="POST.PROCESS" optional="yes"/>
702
703 <sequential>
704 <PRE.PROCESS/>
705 <if>
706 <not>
707 <equals arg1="${LIBS}" arg2=""/>
708 </not>
709
710 <then>
711 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
712 <LIB.ARG></LIB.ARG>
713 <LINK.ARG></LINK.ARG>
714 </GenDll>
715
716 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
717 </then>
718 </if>
719
720 <OnDependency>
721 <sourcefiles>
722 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
723 </sourcefiles>
724 <targetfiles>
725 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>
726 </targetfiles>
727
728 <sequential>
729 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
730 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
731 <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
732 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.te" tofile="${BIN_DIR}/@{FILENAME}.te" />
733 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
734 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
735 sectiontype="EFI_SECTION_TE"/>
736 <POST.PROCESS/>
737 </sequential>
738 </OnDependency>
739 </sequential>
740 </macrodef>
741
742 <macrodef name="EFI_SECTION_PE32">
743 <attribute name="FILEPATH"/>
744 <attribute name="FILENAME"/>
745 <attribute name="FILEEXT" default="" />
746
747 <element name="PRE.PROCESS" optional="yes"/>
748 <element name="POST.PROCESS" optional="yes"/>
749
750 <sequential>
751 <PRE.PROCESS/>
752 <if>
753 <not>
754 <!-- TBD ${OBJECTS} -->
755 <equals arg1="${LIBS}" arg2=""/>
756 </not>
757
758 <then>
759 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
760 <LIB.ARG></LIB.ARG>
761 <LINK.ARG></LINK.ARG>
762 </GenDll>
763
764 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
765 </then>
766 </if>
767
768 <OnDependency>
769 <sourcefiles>
770 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
771 </sourcefiles>
772 <targetfiles>
773 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
774 </targetfiles>
775
776 <sequential>
777 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
778
779 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
780 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
781 sectiontype="EFI_SECTION_PE32"/>
782
783 <POST.PROCESS/>
784 </sequential>
785 </OnDependency>
786 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
787 </sequential>
788 </macrodef>
789
790 <!--
791 EFI_SECTION_VERSION
792 -->
793 <macrodef name="EFI_SECTION_VERSION">
794 <attribute name="FILEPATH"/>
795 <attribute name="FILENAME"/>
796 <attribute name="FILEEXT" default="" />
797 <attribute name="VERSION" default="0000"/>
798
799 <element name="PRE.PROCESS" optional="yes"/>
800 <element name="POST.PROCESS" optional="yes"/>
801
802 <sequential>
803 <if>
804 <not>
805 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
806 </not>
807
808 <then>
809 <PRE.PROCESS/>
810 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
811 versionnum="@{VERSION}"
812 sectiontype="EFI_SECTION_VERSION"/>
813 <POST.PROCESS/>
814 </then>
815 </if>
816 </sequential>
817 </macrodef>
818
819 <!--
820 EFI_SECTION_USER_INTERFACE
821 -->
822 <macrodef name="EFI_SECTION_USER_INTERFACE">
823 <attribute name="FILEPATH"/>
824 <attribute name="FILENAME"/>
825 <attribute name="FILEEXT" default="" />
826 <attribute name="UI" default="${BASE_NAME}"/>
827
828 <element name="PRE.PROCESS" optional="yes"/>
829 <element name="POST.PROCESS" optional="yes"/>
830
831 <sequential>
832 <if>
833 <not>
834 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
835 </not>
836
837 <then>
838 <PRE.PROCESS/>
839 <gensection interfacestring="@{UI}"
840 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
841 sectiontype="EFI_SECTION_USER_INTERFACE"/>
842 <POST.PROCESS/>
843 </then>
844 </if>
845 </sequential>
846 </macrodef>
847
848 <!--
849 EFI_SECTION_DXE_DEPEX
850 -->
851 <macrodef name="EFI_SECTION_DXE_DEPEX">
852 <attribute name="FILEPATH"/>
853 <attribute name="FILENAME"/>
854 <attribute name="FILEEXT" default="dxs"/>
855
856 <element name="PRE.PROCESS" optional="yes"/>
857 <element name="POST.PROCESS" optional="yes"/>
858
859 <sequential>
860 <PRE.PROCESS/>
861
862 <if>
863 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
864 <then>
865 <OnDependency>
866 <sourcefiles>
867 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
868 </sourcefiles>
869 <targetfiles>
870 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
871 </targetfiles>
872 <sequential>
873 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
874 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
875 sectiontype="EFI_SECTION_DXE_DEPEX"/>
876 </sequential>
877 </OnDependency>
878 </then>
879 <else>
880 <if>
881 <not>
882 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
883 </not>
884 <then>
885 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
886 </then>
887 </if>
888 </else>
889 </if>
890
891 <POST.PROCESS/>
892 </sequential>
893 </macrodef>
894
895 <!--
896 EFI_SECTION_PEI_DEPEX
897 -->
898 <macrodef name="EFI_SECTION_PEI_DEPEX">
899 <attribute name="FILEPATH"/>
900 <attribute name="FILENAME"/>
901 <attribute name="FILEEXT" default="dxs"/>
902
903 <element name="PRE.PROCESS" optional="yes"/>
904 <element name="POST.PROCESS" optional="yes"/>
905 <sequential>
906 <PRE.PROCESS/>
907 <if>
908 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
909 <then>
910 <OnDependency>
911 <sourcefiles>
912 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>
913 </sourcefiles>
914 <targetfiles>
915 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
916 </targetfiles>
917
918 <sequential>
919 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"
920 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
921 sectiontype="EFI_SECTION_PEI_DEPEX"/>
922 </sequential>
923 </OnDependency>
924
925 </then>
926 <else>
927 <if>
928 <not>
929 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
930 </not>
931 <then>
932 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
933 </then>
934 </if>
935 </else>
936 </if>
937 <POST.PROCESS/>
938 </sequential>
939 </macrodef>
940
941
942 <!--
943 EFI_SECTION_RAW
944 -->
945 <macrodef name="EFI_SECTION_RAW">
946 <attribute name="FILEPATH"/>
947 <attribute name="FILENAME"/>
948 <attribute name="FILEEXT" default="bin"/>
949
950 <element name="PRE.PROCESS" optional="yes"/>
951 <element name="POST.PROCESS" optional="yes"/>
952
953 <sequential>
954 <OnDependency>
955 <sourcefiles>
956 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"/>
957 </sourcefiles>
958 <targetfiles>
959 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
960 </targetfiles>
961
962 <sequential>
963 <PRE.PROCESS/>
964 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"
965 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
966 sectiontype="EFI_SECTION_RAW"/>
967 <POST.PROCESS/>
968 </sequential>
969 </OnDependency>
970 </sequential>
971 </macrodef>
972
973 <!--
974 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
975 -->
976 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
977 <attribute name="FILEPATH"/>
978 <attribute name="FILENAME"/>
979 <attribute name="FILEEXT" default="fv"/>
980
981 <element name="PRE.PROCESS" optional="yes"/>
982 <element name="POST.PROCESS" optional="yes"/>
983
984 <sequential>
985 <OnDependency>
986 <sourcefiles>
987 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
988 </sourcefiles>
989 <targetfiles>
990 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
991 </targetfiles>
992
993 <sequential>
994 <PRE.PROCESS/>
995
996 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
997 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
998 overwrite="true"/>
999 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1000 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
1001 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
1002
1003 <POST.PROCESS/>
1004 </sequential>
1005 </OnDependency>
1006 </sequential>
1007 </macrodef>
1008
1009 <!--
1010 Binary
1011 -->
1012 <macrodef name="Build_Binary">
1013 <attribute name="FILEPATH"/>
1014 <attribute name="FILENAME"/>
1015 <attribute name="FILEEXT" default="bin"/>
1016
1017 <element name="EXTRA.INC" optional="yes"/>
1018 <element name="EXTRA.ARG" optional="yes"/>
1019
1020 <sequential>
1021 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1022 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1023 </sequential>
1024 </macrodef>
1025
1026 <!--
1027 Graphics (bmp, ...)
1028 -->
1029 <macrodef name="Build_Graphics">
1030 <attribute name="FILEPATH"/>
1031 <attribute name="FILENAME"/>
1032 <attribute name="FILEEXT" default="bmp"/>
1033
1034 <element name="EXTRA.INC" optional="yes"/>
1035 <element name="EXTRA.ARG" optional="yes"/>
1036
1037 <sequential>
1038 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1039 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1040 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1041 </sequential>
1042 </macrodef>
1043 <macrodef name="Build_EFI">
1044 <attribute name="FILEPATH"/>
1045 <attribute name="FILENAME"/>
1046 <attribute name="FILEEXT" default="efi"/>
1047
1048 <element name="EXTRA.INC" optional="yes"/>
1049 <element name="EXTRA.ARG" optional="yes"/>
1050
1051 <sequential>
1052 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1053 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1054 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1055 </sequential>
1056 </macrodef>
1057 </project>