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