Convert backslashes to forward slashes in many build files. This is necessary for...
[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 <cc userdefine="on">
620 <command type="LINK">
621 <argument value="${LINK_FLAGS}"/>
622 <libset libs="${LIBS}"/>
623 <LINK.ARG/>
624 <EntryPoint value="_ModuleEntryPoint"/>
625 <map value="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.map"/>
626 <pdb value="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.pdb"/>
627 <OutputFile value="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
628 <FileList dir="" files="${OBJECTS}"/>
629 </command>
630 </cc>
631 </sequential>
632 </OnDependency>
633 </sequential>
634 </macrodef>
635
636 <!--
637 EFI
638 -->
639 <macrodef name="GenEfi">
640 <attribute name="FILEPATH"/>
641 <attribute name="FILENAME"/>
642 <attribute name="FILEEXT" default="dll"/>
643
644 <sequential>
645 <OnDependency>
646 <sourcefiles>
647 <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
648 </sourcefiles>
649 <targetfiles>
650 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
651 </targetfiles>
652
653 <sequential>
654 <fwimage componenttype="${COMPONENT_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
655 peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
656 </sequential>
657 </OnDependency>
658 </sequential>
659 </macrodef>
660
661 <!--
662 EFI_SECTION_FREEFORM_SUBTYPE_GUID
663 EFI_SECTION_VERSION
664 EFI_SECTION_USER_INTERFACE
665 EFI_SECTION_DXE_DEPEX
666 EFI_SECTION_PEI_DEPEX
667 EFI_SECTION_PE32
668 EFI_SECTION_PIC
669 EFI_SECTION_TE
670 EFI_SECTION_RAW
671 EFI_SECTION_COMPRESSION
672 EFI_SECTION_GUID_DEFINED
673 EFI_SECTION_COMPATIBILITY16
674 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
675 -->
676 <!--
677 EFI_SECTION_PE32
678 -->
679 <macrodef name="EFI_SECTION_PE32">
680 <attribute name="FILEPATH"/>
681 <attribute name="FILENAME"/>
682 <attribute name="FILEEXT" default="" />
683
684 <element name="PRE.PROCESS" optional="yes"/>
685 <element name="POST.PROCESS" optional="yes"/>
686
687 <sequential>
688 <PRE.PROCESS/>
689
690 <if>
691 <not>
692 <equals arg1="${OBJECTS}" arg2=""/>
693 </not>
694
695 <then>
696 <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
697 <LIB.ARG></LIB.ARG>
698 <LINK.ARG></LINK.ARG>
699 </GenDll>
700
701 <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
702 </then>
703 </if>
704
705 <OnDependency>
706 <sourcefiles>
707 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
708 </sourcefiles>
709 <targetfiles>
710 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>
711 </targetfiles>
712
713 <sequential>
714 <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
715 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
716 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
717 sectiontype="EFI_SECTION_PE32"/>
718
719 <POST.PROCESS/>
720 </sequential>
721 </OnDependency>
722 </sequential>
723 </macrodef>
724
725 <!--
726 EFI_SECTION_VERSION
727 -->
728 <macrodef name="EFI_SECTION_VERSION">
729 <attribute name="FILEPATH"/>
730 <attribute name="FILENAME"/>
731 <attribute name="FILEEXT" default="" />
732 <attribute name="VERSION" default="0000"/>
733
734 <element name="PRE.PROCESS" optional="yes"/>
735 <element name="POST.PROCESS" optional="yes"/>
736
737 <sequential>
738 <if>
739 <not>
740 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>
741 </not>
742
743 <then>
744 <PRE.PROCESS/>
745 <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"
746 versionnum="@{VERSION}"
747 sectiontype="EFI_SECTION_VERSION"/>
748 <POST.PROCESS/>
749 </then>
750 </if>
751 </sequential>
752 </macrodef>
753
754 <!--
755 EFI_SECTION_USER_INTERFACE
756 -->
757 <macrodef name="EFI_SECTION_USER_INTERFACE">
758 <attribute name="FILEPATH"/>
759 <attribute name="FILENAME"/>
760 <attribute name="FILEEXT" default="" />
761 <attribute name="UI" default="${BASE_NAME}"/>
762
763 <element name="PRE.PROCESS" optional="yes"/>
764 <element name="POST.PROCESS" optional="yes"/>
765
766 <sequential>
767 <if>
768 <not>
769 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>
770 </not>
771
772 <then>
773 <PRE.PROCESS/>
774 <gensection interfacestring="@{UI}"
775 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"
776 sectiontype="EFI_SECTION_USER_INTERFACE"/>
777 <POST.PROCESS/>
778 </then>
779 </if>
780 </sequential>
781 </macrodef>
782
783 <!--
784 EFI_SECTION_FREEFORM_SUBTYPE_GUID
785 <macrodef name="EFI_SECTION_FREEFORM_SUBTYPE_GUID">
786 <attribute name="FILEPATH"/>
787 <attribute name="FILENAME"/>
788 <attribute name="FILEEXT" default=""/>
789
790 <element name="EXTRA.INC" optional="yes"/>
791 <element name="EXTRA.ARG" optional="yes"/>
792
793 <sequential>
794 <gensection inputfile=""
795 outputfile=""
796 sectiontype="EFI_SECTION_FREEFORM_SUBTYPE_GUID"/>
797 </sequential>
798 </macrodef>
799 -->
800
801 <!--
802 EFI_SECTION_DXE_DEPEX
803 -->
804 <macrodef name="EFI_SECTION_DXE_DEPEX">
805 <attribute name="FILEPATH"/>
806 <attribute name="FILENAME"/>
807 <attribute name="FILEEXT" default="dxs"/>
808
809 <element name="PRE.PROCESS" optional="yes"/>
810 <element name="POST.PROCESS" optional="yes"/>
811
812 <sequential>
813 <PRE.PROCESS/>
814
815 <if>
816 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}.depex"/>
817 <then>
818 <OnDependency>
819 <sourcefiles>
820 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}.depex"/>
821 </sourcefiles>
822 <targetfiles>
823 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
824 </targetfiles>
825 <sequential>
826 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}.depex"
827 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
828 sectiontype="EFI_SECTION_DXE_DEPEX"/>
829 </sequential>
830 </OnDependency>
831 </then>
832 <else>
833 <if>
834 <not>
835 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
836 </not>
837 <then>
838 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
839 </then>
840 </if>
841 </else>
842 </if>
843
844 <POST.PROCESS/>
845 </sequential>
846 </macrodef>
847
848 <!--
849 EFI_SECTION_PEI_DEPEX
850 -->
851 <macrodef name="EFI_SECTION_PEI_DEPEX">
852 <attribute name="FILEPATH"/>
853 <attribute name="FILENAME"/>
854 <attribute name="FILEEXT" default="dxs"/>
855
856 <element name="PRE.PROCESS" optional="yes"/>
857 <element name="POST.PROCESS" optional="yes"/>
858 <sequential>
859 <PRE.PROCESS/>
860 <if>
861 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}.depex"/>
862 <then>
863 <OnDependency>
864 <sourcefiles>
865 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}.depex"/>
866 </sourcefiles>
867 <targetfiles>
868 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
869 </targetfiles>
870
871 <sequential>
872 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}.depex"
873 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"
874 sectiontype="EFI_SECTION_PEI_DEPEX"/>
875 </sequential>
876 </OnDependency>
877
878 </then>
879 <else>
880 <if>
881 <not>
882 <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
883 </not>
884 <then>
885 <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>
886 </then>
887 </if>
888 </else>
889 </if>
890 <POST.PROCESS/>
891 </sequential>
892 </macrodef>
893
894 <!--
895 EFI_SECTION_PIC
896 <macrodef name="EFI_SECTION_PIC">
897 <attribute name="FILEPATH"/>
898 <attribute name="FILENAME"/>
899 <attribute name="FILEEXT" default=""/>
900
901 <element name="EXTRA.INC" optional="yes"/>
902 <element name="EXTRA.ARG" optional="yes"/>
903
904 <sequential>
905 <gensection inputfile="${BIN_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
906 outputfile="${BIN_DIR}/@{FILENAME}.pe32"
907 sectiontype="EFI_SECTION_PIC"/>
908 </sequential>
909 </macrodef>
910 -->
911
912 <!--
913 EFI_SECTION_TE
914 <macrodef name="EFI_SECTION_TE">
915 <attribute name="FILEPATH"/>
916 <attribute name="FILENAME"/>
917 <attribute name="FILEEXT" default=""/>
918
919 <element name="EXTRA.INC" optional="yes"/>
920 <element name="EXTRA.ARG" optional="yes"/>
921
922 <sequential>
923 <gensection inputfile="${BIN_DIR}/@{FILENAME}.@{FILEEXT}"
924 outputfile="${BIN_DIR}/@{FILENAME}.pe32"
925 sectiontype="EFI_SECTION_PE32"/>
926 </sequential>
927 </macrodef>
928 -->
929
930 <!--
931 EFI_SECTION_RAW
932 -->
933 <macrodef name="EFI_SECTION_RAW">
934 <attribute name="FILEPATH"/>
935 <attribute name="FILENAME"/>
936 <attribute name="FILEEXT" default="bin"/>
937
938 <element name="PRE.PROCESS" optional="yes"/>
939 <element name="POST.PROCESS" optional="yes"/>
940
941 <sequential>
942 <OnDependency>
943 <sourcefiles>
944 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"/>
945 </sourcefiles>
946 <targetfiles>
947 <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>
948 </targetfiles>
949
950 <sequential>
951 <PRE.PROCESS/>
952 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.@{FILEEXT}"
953 outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"
954 sectiontype="EFI_SECTION_RAW"/>
955 <POST.PROCESS/>
956 </sequential>
957 </OnDependency>
958 </sequential>
959 </macrodef>
960
961 <!--
962 EFI_SECTION_COMPRESSION
963 <macrodef name="EFI_SECTION_COMPRESSION">
964 <attribute name="FILEPATH"/>
965 <attribute name="FILENAME"/>
966 <attribute name="FILEEXT" default=""/>
967
968 <element name="EXTRA.INC" optional="yes"/>
969 <element name="EXTRA.ARG" optional="yes"/>
970
971 <sequential>
972 <gensection inputfile="${BIN_DIR}/@{FILENAME}.@{FILEEXT}"
973 outputfile="${BIN_DIR}/@{FILENAME}.pe32"
974 sectiontype="EFI_SECTION_PE32"/>
975 </sequential>
976 </macrodef>
977 -->
978
979 <!--
980 EFI_SECTION_GUID_DEFINED
981 <macrodef name="EFI_SECTION_GUID_DEFINED">
982 <attribute name="FILEPATH"/>
983 <attribute name="FILENAME"/>
984 <attribute name="FILEEXT" default=""/>
985
986 <element name="EXTRA.INC" optional="yes"/>
987 <element name="EXTRA.ARG" optional="yes"/>
988
989 <sequential>
990 <gensection inputfile="${BIN_DIR}/@{FILENAME}.@{FILEEXT}"
991 outputfile="${BIN_DIR}/@{FILENAME}.pe32"
992 sectiontype="EFI_SECTION_PE32"/>
993 </sequential>
994 </macrodef>
995 -->
996
997 <!--
998 EFI_SECTION_COMPATIBILITY16
999 <macrodef name="EFI_SECTION_COMPATIBILITY16">
1000 <attribute name="FILEPATH"/>
1001 <attribute name="FILENAME"/>
1002 <attribute name="FILEEXT" default=""/>
1003
1004 <element name="EXTRA.INC" optional="yes"/>
1005 <element name="EXTRA.ARG" optional="yes"/>
1006
1007 <sequential>
1008 <gensection inputfile="${BIN_DIR}/@{FILENAME}.@{FILEEXT}"
1009 outputfile="${BIN_DIR}/@{FILENAME}.pe32"
1010 sectiontype="EFI_SECTION_PE32"/>
1011 </sequential>
1012 </macrodef>
1013
1014 -->
1015 <!--
1016 EFI_SECTION_FIRMWARE_VOLUME_IMAGE
1017 -->
1018 <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">
1019 <attribute name="FILEPATH"/>
1020 <attribute name="FILENAME"/>
1021 <attribute name="FILEEXT" default="fv"/>
1022
1023 <element name="PRE.PROCESS" optional="yes"/>
1024 <element name="POST.PROCESS" optional="yes"/>
1025
1026 <sequential>
1027 <OnDependency>
1028 <sourcefiles>
1029 <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
1030 </sourcefiles>
1031 <targetfiles>
1032 <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>
1033 </targetfiles>
1034
1035 <sequential>
1036 <PRE.PROCESS/>
1037
1038 <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1039 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1040 overwrite="true"/>
1041 <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1042 outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"
1043 sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>
1044
1045 <POST.PROCESS/>
1046 </sequential>
1047 </OnDependency>
1048 </sequential>
1049 </macrodef>
1050
1051 <!--
1052 Binary
1053 -->
1054 <macrodef name="Build_Binary">
1055 <attribute name="FILEPATH"/>
1056 <attribute name="FILENAME"/>
1057 <attribute name="FILEEXT" default="bin"/>
1058
1059 <element name="EXTRA.INC" optional="yes"/>
1060 <element name="EXTRA.ARG" optional="yes"/>
1061
1062 <sequential>
1063 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1064 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1065 </sequential>
1066 </macrodef>
1067
1068 <!--
1069 Graphics (bmp, ...)
1070 -->
1071 <macrodef name="Build_Graphics">
1072 <attribute name="FILEPATH"/>
1073 <attribute name="FILENAME"/>
1074 <attribute name="FILEEXT" default="bmp"/>
1075
1076 <element name="EXTRA.INC" optional="yes"/>
1077 <element name="EXTRA.ARG" optional="yes"/>
1078
1079 <sequential>
1080 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1081 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1082 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
1083 </sequential>
1084 </macrodef>
1085 <macrodef name="Build_EFI">
1086 <attribute name="FILEPATH"/>
1087 <attribute name="FILENAME"/>
1088 <attribute name="FILEEXT" default="efi"/>
1089
1090 <element name="EXTRA.INC" optional="yes"/>
1091 <element name="EXTRA.ARG" optional="yes"/>
1092
1093 <sequential>
1094 <mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
1095 <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
1096 tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
1097 </sequential>
1098 </macrodef>
1099 </project>