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