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