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