Add dependency for RealAsm file build rules and Use the module name in place of macro...
[people/mcb30/edk2.git] / edk2 / Tools / Conf / BuildMacro.xml
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <!--\r
3 Copyright (c) 2006, Intel Corporation\r
4 All rights reserved. This program and the accompanying materials\r
5 are licensed and made available under the terms and conditions of the BSD License\r
6 which accompanies this distribution.  The full text of the license may be found at\r
7 http://opensource.org/licenses/bsd-license.php\r
8 \r
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11 -->\r
12 <project name="common">\r
13   <!--\r
14     Macro for intialize some properties. This Macro build will be called before source file build.  \r
15     -->\r
16   <macrodef name="Build_Init">\r
17     <element name="EXTRA.INC" optional="yes"/>\r
18     <element name="EXTRA.ARG" optional="yes"/>\r
19     \r
20     <sequential>\r
21       <var name="OBJECTS" value="" />\r
22       <var name="SDB_FILES" value="" />\r
23 \r
24       <if>\r
25         <and>\r
26           <isset property="PCH"/>\r
27           <not>\r
28             <equals arg1="${PCH}" arg2=""/>\r
29           </not>\r
30         </and>\r
31         <then>\r
32           <if>\r
33             <available type="file" file="${DEST_DIR_OUTPUT}/AutoGen.h.gch"/>\r
34             <then>\r
35               <makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep">\r
36                 <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>\r
37                 <EXTRA.INC/>\r
38               </makedeps>\r
39             </then>\r
40           </if>\r
41     \r
42           <OnDependency>\r
43             <sourcefiles>\r
44               <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>\r
45             </sourcefiles>\r
46             <targetfiles>\r
47               <file Name="${DEST_DIR_OUTPUT}/AutoGen.h.gch"/>\r
48             </targetfiles>\r
49     \r
50             <sequential>\r
51               <!-- Generate pre-compiled header -->\r
52               <cc userdefine="on">\r
53                 <command type="CC" cmd="${PCH}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
54                     outputFile="${DEST_DIR_OUTPUT}/AutoGen.h.obj" dpath="${CC_DPATH}" libpath="${CC_LIBPATH}" \r
55                     include="${CC_INCLUDEPATH}">\r
56                   <EXTRA.INC/>\r
57                   <argument value="${PCH_FLAGS}"/>\r
58                   <EXTRA.ARG/>\r
59                   <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/AutoGen.h"/>\r
60                 </command>\r
61               </cc>\r
62 \r
63               <if>\r
64                 <equals arg1="${CC_FAMILY}" arg2="GCC"/>\r
65                 <then>\r
66                   <move file="${DEST_DIR_OUTPUT}/AutoGen.h.obj" tofile="${DEST_DIR_DEBUG}/AutoGen.h.gch" overwrite="true"/>\r
67                 </then>\r
68               </if>\r
69             </sequential>\r
70           </OnDependency>\r
71 \r
72           <if>\r
73             <not>\r
74               <equals arg1="${CC_FAMILY}" arg2="GCC"/>\r
75             </not>\r
76             <then>\r
77               <var name="OBJECTS" value="${OBJECTS} AutoGen.h.obj"/>\r
78             </then>\r
79           </if>\r
80         </then>\r
81       </if>\r
82     </sequential>\r
83   </macrodef>\r
84 \r
85 \r
86   <!--\r
87     macro definitions for building files with different types\r
88     -->\r
89   <!--\r
90     C Code\r
91     -->\r
92   <macrodef name="Build_CCode">\r
93     <attribute name="FILEPATH"/>\r
94     <attribute name="FILENAME"/>\r
95     <attribute name="FILEEXT" default="c"/>\r
96     \r
97     <element name="EXTRA.INC" optional="yes"/>\r
98     <element name="EXTRA.ARG" optional="yes"/>\r
99     \r
100     <sequential>\r
101       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
102       <var name="FILE_PATH" value="@{FILEPATH}" />\r
103       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
104 \r
105       <if>\r
106         <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
107         <then>\r
108           <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">\r
109             <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
110             <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>\r
111             <EXTRA.INC/>\r
112           </makedeps>\r
113         </then>\r
114       </if>\r
115 \r
116       <OnDependency>\r
117         <sourcefiles>\r
118           <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>\r
119         </sourcefiles>\r
120         <targetfiles>\r
121           <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
122         </targetfiles>\r
123 \r
124         <sequential>\r
125           <cc userdefine="on">\r
126             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
127                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}" \r
128                 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">\r
129               <EXTRA.INC/>\r
130               <argument value="${CC_FLAGS}"/>\r
131               <EXTRA.ARG/>\r
132               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
133             </command>\r
134           </cc>\r
135         </sequential>\r
136       </OnDependency>\r
137       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
138       <if>\r
139         <equals arg1="@{FILEPATH}" arg2="." />\r
140         <then>\r
141           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />\r
142         </then>\r
143         <else>\r
144           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />\r
145         </else>\r
146       </if>\r
147     </sequential>\r
148   </macrodef>\r
149 \r
150 \r
151   <macrodef name="Build_AUTOGEN">\r
152     <attribute name="FILEPATH"/>\r
153     <attribute name="FILENAME"/>\r
154     <attribute name="FILEEXT" default="c"/>\r
155 \r
156     <element name="EXTRA.INC" optional="yes"/>\r
157     <element name="EXTRA.ARG" optional="yes"/>\r
158 \r
159     <sequential>\r
160       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
161       <var name="FILE_PATH" value="@{FILEPATH}" />\r
162       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
163 \r
164       <if>\r
165         <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
166         <then>\r
167           <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">\r
168             <input file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
169             <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>\r
170             <EXTRA.INC/>\r
171           </makedeps>\r
172         </then>\r
173       </if>\r
174 \r
175       <OnDependency>\r
176         <sourcefiles>\r
177           <file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>\r
178         </sourcefiles>\r
179         <targetfiles>\r
180           <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
181         </targetfiles>\r
182 \r
183         <sequential>\r
184           <cc userdefine="on">\r
185             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
186                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${CC_DPATH}"\r
187                 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">\r
188               <EXTRA.INC/>\r
189               <argument value="${CC_FLAGS}"/>\r
190               <EXTRA.ARG/>\r
191               <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
192             </command>\r
193           </cc>\r
194         </sequential>\r
195       </OnDependency>\r
196       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
197       <if>\r
198         <equals arg1="@{FILEPATH}" arg2="." />\r
199         <then>\r
200           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />\r
201         </then>\r
202         <else>\r
203           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />\r
204         </else>\r
205       </if>\r
206     </sequential>\r
207   </macrodef>\r
208 \r
209   <macrodef name="Build_DPX">\r
210     <attribute name="FILEPATH"/>\r
211     <attribute name="FILENAME"/>\r
212     <attribute name="FILEEXT" default="dxs"/>\r
213 \r
214     <element name="EXTRA.INC" optional="yes"/>\r
215     <element name="EXTRA.ARG" optional="yes"/>\r
216         \r
217 \r
218     <sequential>\r
219       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
220       <var name="FILE_PATH" value="@{FILEPATH}" />\r
221       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
222 \r
223       <OnDependency>\r
224         <sourcefiles>\r
225           <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
226         </sourcefiles>\r
227         <targetfiles>\r
228           <file name="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>\r
229         </targetfiles>\r
230 \r
231         <sequential>\r
232           <cc userdefine="on">\r
233             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${CC_FAMILY}"\r
234                      outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" dpath="${CC_DPATH}"\r
235                      libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">\r
236               <EXTRA.INC/>\r
237               <argument value="${PP_FLAGS}"/>\r
238               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
239             </command>\r
240           </cc>\r
241     \r
242           <gendepex inputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i" outputFile="${DEST_DIR_OUTPUT}/${BASE_NAME}.depex"/>\r
243         </sequential>\r
244       </OnDependency>\r
245     </sequential>\r
246   </macrodef>\r
247   \r
248   <macrodef name="Build_ASM">\r
249     <attribute name="FILEPATH"/>\r
250     <attribute name="FILENAME"/>\r
251     <attribute name="FILEEXT" default="asm"/>\r
252 \r
253     <element name="EXTRA.INC" optional="yes"/>\r
254     <element name="EXTRA.ARG" optional="yes"/>\r
255     \r
256     <!-- Dispath ASM file, there are three type. \r
257          asm     -   Build_Assembly\r
258          S       -   Build_Gcc_Assembly\r
259          s       -   Build_Ipf_Assembly -->\r
260     <sequential>\r
261             <if>\r
262         <equals arg1="@{FILEEXT}" arg2="asm" />\r
263               <then>\r
264                 <Build_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">\r
265             <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>\r
266             <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>\r
267           </Build_Assembly>\r
268               </then>\r
269         <elseif>\r
270           <equals arg1="@{FILEEXT}" arg2="S" />\r
271           <then>\r
272             <Build_Gcc_Assembly FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">\r
273               <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>\r
274               <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>\r
275             </Build_Gcc_Assembly>\r
276           </then>\r
277         </elseif>\r
278               <elseif>\r
279                 <equals arg1="@{FILEEXT}" arg2="s" />\r
280                 <then>\r
281                   <Build_IPF_Assembly_Code FILEPATH="@{FILEPATH}" FILENAME="@{FILENAME}" FILEEXT="@{FILEEXT}">\r
282                     <EXTRA.INC.1><EXTRA.INC /></EXTRA.INC.1>\r
283               <EXTRA.ARG.1><EXTRA.ARG /></EXTRA.ARG.1>\r
284             </Build_IPF_Assembly_Code>\r
285                 </then>\r
286               </elseif>\r
287             </if>\r
288     </sequential>\r
289   </macrodef>\r
290   \r
291   <!--\r
292     IA32/x64 Assembly\r
293     -->\r
294   <macrodef name="Build_Assembly">\r
295     <attribute name="FILEPATH"/>\r
296     <attribute name="FILENAME"/>\r
297     <attribute name="FILEEXT" default="asm"/>\r
298 \r
299     <element name="EXTRA.INC.1" optional="yes"/>\r
300     <element name="EXTRA.ARG.1" optional="yes"/>\r
301 \r
302     <sequential>\r
303       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
304       <var name="FILE_PATH" value="@{FILEPATH}" />\r
305       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
306 \r
307       <OnDependency>\r
308         <sourcefiles>\r
309           <file Name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
310         </sourcefiles>\r
311         <targetfiles>\r
312           <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
313         </targetfiles>\r
314 \r
315         <sequential>\r
316           <cc userdefine="on">\r
317             <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" \r
318                 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">\r
319               <EXTRA.INC.1/>\r
320               <argument value="${PP_FLAGS}"/>\r
321               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
322             </command>\r
323           </cc>\r
324 \r
325           <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"\r
326                          match="^(#line +1 +.*@{FILEPATH}/@{FILENAME}\.@{FILEEXT}&quot;).+\1"\r
327                          replace=";"\r
328                          flags="gs"/>\r
329           <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"\r
330                          match="^(#line .*)$"\r
331                          replace="; \1"\r
332                          byline="true"/>\r
333           <replaceregexp file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"\r
334                          match="([^_a-zA-Z])0x([0-9a-fA-F]+)"\r
335                          replace="\10\2h"\r
336                          flags="g"\r
337                          byline="true"/>\r
338 \r
339           <cc userdefine="on">\r
340             <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"\r
341                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"\r
342                 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">\r
343               <EXTRA.INC.1/>\r
344       \r
345               <argument value="${ASM_FLAGS}"/>\r
346               <EXTRA.ARG.1/>\r
347       \r
348               <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>\r
349             </command>\r
350           </cc>\r
351         </sequential>\r
352       </OnDependency>\r
353       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
354       <if>\r
355         <equals arg1="@{FILEPATH}" arg2="." />\r
356         <then>\r
357           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />\r
358         </then>\r
359         <else>\r
360           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />\r
361         </else>\r
362       </if>\r
363     </sequential>\r
364   </macrodef>\r
365 \r
366   <!--\r
367     Build GCC assembly code\r
368     -->\r
369   <macrodef name="Build_Gcc_Assembly">\r
370     <attribute name="FILEPATH"/>\r
371     <attribute name="FILENAME"/>\r
372     <attribute name="FILEEXT" default="asm"/>\r
373 \r
374     <element name="EXTRA.INC.1" optional="yes"/>\r
375     <element name="EXTRA.ARG.1" optional="yes"/>\r
376 \r
377     <sequential>\r
378       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
379       <var name="FILE_PATH" value="@{FILEPATH}" />\r
380       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
381 \r
382       <OnDependency>\r
383         <sourcefiles>\r
384           <file Name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
385         </sourcefiles>\r
386         <targetfiles>\r
387           <file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
388         </targetfiles>\r
389 \r
390         <sequential>\r
391           <cc userdefine="on">\r
392             <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"\r
393                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" dpath="${ASM_DPATH}"\r
394                 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">\r
395               <EXTRA.INC.1/>\r
396       \r
397               <argument value="${ASM_FLAGS}"/>\r
398               <EXTRA.ARG.1/>\r
399       \r
400               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
401             </command>\r
402           </cc>\r
403         </sequential>\r
404       </OnDependency>\r
405       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
406       <if>\r
407         <equals arg1="@{FILEPATH}" arg2="." />\r
408         <then>\r
409           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />\r
410         </then>\r
411         <else>\r
412           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />\r
413         </else>\r
414       </if>\r
415     </sequential>\r
416   </macrodef>\r
417 \r
418   <!--\r
419     IPF Assembly\r
420     -->\r
421   <macrodef name="Build_IPF_Assembly_Code">\r
422     <attribute name="FILEPATH"/>\r
423     <attribute name="FILENAME"/>\r
424     <attribute name="FILEEXT" default="s"/>\r
425 \r
426     <element name="EXTRA.INC.1" optional="yes"/>\r
427     <element name="EXTRA.ARG.1" optional="yes"/>\r
428 \r
429     <sequential>\r
430       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
431 \r
432       <if>\r
433         <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
434         <then>\r
435           <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">\r
436             <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
437             <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>\r
438             <EXTRA.INC.1/>\r
439           </makedeps>\r
440         </then>\r
441       </if>\r
442 \r
443       <OnDependency>\r
444         <sourcefiles>\r
445           <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>\r
446         </sourcefiles>\r
447         <targetfiles>\r
448           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
449         </targetfiles>\r
450 \r
451         <sequential>\r
452           <cc userdefine="on">\r
453             <command type="PP" cmd="${APP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${APP_FAMILY}" \r
454                 dpath="${APP_DPATH}" libpath="${APP_LIBPATH}" include="${APP_INCLUDEPATH}">\r
455               <EXTRA.INC.1/>\r
456               <argument value="${APP_FLAGS}"/>\r
457               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
458             </command>\r
459           </cc>\r
460       \r
461           <cc userdefine="on">\r
462             <command type="ASM" cmd="${ASM}" workdir="${DEST_DIR_OUTPUT}" family="${ASM_FAMILY}"\r
463                 includepathDelimiter="-I" outputDelimiter="-o" dpath="${ASM_DPATH}"\r
464                 libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}"\r
465                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">\r
466               <EXTRA.INC.1/>\r
467               <argument value="${ASM_FLAGS}"/>\r
468               <EXTRA.ARG.1/>\r
469               <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>\r
470             </command>\r
471           </cc>\r
472         </sequential>\r
473       </OnDependency>\r
474       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
475       <if>\r
476         <equals arg1="@{FILEPATH}" arg2="." />\r
477         <then>\r
478           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />\r
479         </then>\r
480         <else>\r
481           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />\r
482         </else>\r
483       </if>\r
484     </sequential>\r
485   </macrodef>\r
486 \r
487 \r
488   <macrodef name="Build_IPF_PP_Code">\r
489     <attribute name="FILEPATH"/>\r
490     <attribute name="FILENAME"/>\r
491     <attribute name="FILEEXT" default="i"/>\r
492 \r
493     <element name="EXTRA.INC" optional="yes"/>\r
494     <element name="EXTRA.ARG" optional="yes"/>\r
495 \r
496     <sequential>\r
497       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
498   \r
499       <cc userdefine="on">\r
500         <command type="ASM" includepathDelimiter="-I" dpath="${ASM_DPATH}"\r
501              libpath="${ASM_LIBPATH}" include="${ASM_INCLUDEPATH}">\r
502           <includepath path="${WORKSPACE_DIR}"/>\r
503           <includepath path="${MODULE_DIR}"/>\r
504           <includepath path="${MODULE_DIR}/${ARCH}"/>\r
505           <EXTRA.INC/>\r
506   \r
507           <argument value="${ASM_FLAGS}"/>\r
508           <EXTRA.ARG/>\r
509           <OutputFile File="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
510   \r
511           <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
512         </command>\r
513       </cc>\r
514     </sequential>\r
515   </macrodef>\r
516   \r
517   \r
518     <!--\r
519     Library    private HashMap map = new HashMap();\r
520     -->\r
521   <macrodef name="Build_Library">\r
522     <attribute name="FILENAME" />\r
523     <attribute name="FILEEXT" default="obj"/>\r
524     \r
525     <sequential>\r
526       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
527       <var name="FILE_PATH" value="." />\r
528       <mkdir dir="${BIN_DIR}"/>\r
529 \r
530       <OnDependency>\r
531         <sourcefiles>\r
532           <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />\r
533         </sourcefiles>\r
534         <targetfiles>\r
535           <file name="${BIN_DIR}/@{FILENAME}.lib"/>\r
536         </targetfiles>\r
537 \r
538         <sequential>\r
539           <cc userdefine="on">\r
540             <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}"\r
541                 outputFile="${BIN_DIR}/@{FILENAME}.lib" dpath="${SLINK_DPATH}"\r
542                 libpath="${SLINK_LIBPATH}" include="${SLINK_INCLUDEPATH}">\r
543               <argument value="${SLINK_FLAGS}"/>\r
544 \r
545               <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>\r
546             </command>\r
547           </cc>\r
548         </sequential>\r
549       </OnDependency>\r
550     </sequential>\r
551   </macrodef>\r
552 \r
553   <!--\r
554     Unicode -> .sdb\r
555     -->\r
556   <macrodef name="Build_UNI">\r
557     <attribute name="FILEPATH"/>\r
558     <attribute name="FILENAME"/>\r
559     <attribute name="FILEEXT" default="uni"/>\r
560 \r
561     <element name="EXTRA.INC" optional="yes"/>\r
562     <element name="EXTRA.ARG" optional="yes"/>\r
563 \r
564     <sequential>\r
565       <mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>\r
566 \r
567       <OnDependency>\r
568         <sourcefiles>\r
569           <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
570         </sourcefiles>\r
571         <targetfiles>\r
572           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>\r
573         </targetfiles>\r
574 \r
575         <sequential>\r
576           <strgather commandtype="parse" newdatabase="true">\r
577             <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>\r
578             <EXTRA.INC/>\r
579             <EXTRA.ARG/>\r
580             <inputfile name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
581           </strgather>\r
582         </sequential>\r
583       </OnDependency>\r
584 \r
585       <var name="SDB_FILES" value="${SDB_FILES}, ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>\r
586     </sequential>\r
587   </macrodef>\r
588 \r
589   <!--\r
590     .sdb(s) -> .c, .h -> .obj\r
591     -->\r
592   <macrodef name="Build_Unicode_Database">\r
593     <attribute name="FILEPATH"/>\r
594     <attribute name="FILENAME"/>\r
595     <attribute name="FILEEXT" default="sdb"/>\r
596 \r
597     <element name="EXTRA.INC" optional="yes"/>\r
598     <element name="EXTRA.ARG" optional="yes"/>\r
599 \r
600     <sequential>\r
601       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
602       <var name="FILE_PATH" value="@{FILEPATH}" />\r
603       <OnDependency>\r
604         <sourcefiles>\r
605           <file list="${SDB_FILES}"/>\r
606           <file list="${SOURCE_FILES}"/>\r
607         </sourcefiles>\r
608         <targetfiles>\r
609           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>\r
610         </targetfiles>\r
611         \r
612         <sequential>\r
613           <strgather commandtype="scan" outputdatabase="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb" verbose="read">\r
614             <skipext name=".uni"/>\r
615             <skipext name=".h"/>\r
616             <database list="${SDB_FILES}"/>\r
617             <inputfile name="${SOURCE_FILES}"/>\r
618           </strgather>\r
619         </sequential>\r
620       </OnDependency>\r
621 \r
622       <OnDependency>\r
623         <sourcefiles>\r
624           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>\r
625         </sourcefiles>\r
626         <targetfiles>\r
627           <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"/>\r
628           <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"/>\r
629           <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>\r
630         </targetfiles>\r
631         \r
632         <sequential>\r
633           <strgather basename="@{FILENAME}Strings" commandtype="dump"\r
634                      outputdefines="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}StrDefs.h"\r
635                      outputhpk="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.hpk"\r
636                      outputstring="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c">\r
637             <database name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>\r
638           </strgather>\r
639         </sequential>\r
640       </OnDependency>\r
641 \r
642       <OnDependency>\r
643         <sourcefiles>\r
644           <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>\r
645           <file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>\r
646         </sourcefiles>\r
647         <targetfiles>\r
648           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj"/>\r
649         </targetfiles>\r
650         \r
651         <sequential>\r
652           <cc userdefine="on">\r
653             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
654                      includepathDelimiter="-I" dpath="${CC_DPATH}"\r
655                      libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"\r
656                      outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Strings.obj">\r
657               <argument value="${CC_FLAGS}"/>\r
658               <EXTRA.INC />\r
659               <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}Strings.c"/>\r
660             </command>\r
661           </cc>\r
662         </sequential>\r
663       </OnDependency>\r
664 \r
665       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
666       <if>\r
667         <equals arg1="@{FILEPATH}" arg2="." />\r
668         <then>\r
669           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}Strings.obj" />\r
670         </then>\r
671         <else>\r
672           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}Strings.obj" />\r
673         </else>\r
674       </if>\r
675     </sequential>\r
676   </macrodef>\r
677 \r
678   <!--\r
679     Vfr\r
680     -->\r
681   <macrodef name="Build_VFR">\r
682     <attribute name="FILEPATH"/>\r
683     <attribute name="FILENAME"/>\r
684     <attribute name="FILEEXT" default="vfr"/>\r
685 \r
686     <element name="EXTRA.INC" optional="yes"/>\r
687     <element name="EXTRA.ARG" optional="yes"/>\r
688 \r
689     <sequential>\r
690       <mkdir dir="${DEST_DIR_DEBUG}/@{FILEPATH}"/>\r
691 \r
692       <if>\r
693         <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
694         <then>\r
695           <makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">\r
696             <input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
697             <input file="${DEST_DIR_DEBUG}/AutoGen.h"/>\r
698             <EXTRA.INC/>\r
699           </makedeps>\r
700         </then>\r
701       </if>\r
702 \r
703       <OnDependency>\r
704         <sourcefiles>\r
705           <file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>\r
706         </sourcefiles>\r
707         <targetfiles>\r
708           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>\r
709         </targetfiles>\r
710 \r
711         <sequential>\r
712           <!-- if "TOOLCHIAN FAMILY" is "GCC", it should point the ouput file for preprocess compiler -->         \r
713           <if>\r
714             <equals arg1="${CC_FAMILY}" arg2="GCC"/>\r
715             <then>\r
716               <cc userdefine="on">\r
717                 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" \r
718                          dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">\r
719                   <argument value="${VFRPP_FLAGS} -o ${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i"/>\r
720                   <!-- Output file of the preprocess -->   \r
721                   <EXTRA.INC/>            \r
722                   <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>              \r
723                 </command>\r
724               </cc>\r
725             </then>\r
726           </if>\r
727           \r
728           <if>\r
729             <not>\r
730               <equals arg1="${CC_FAMILY}" arg2="GCC"/>\r
731             </not>\r
732             <then>\r
733               <cc userdefine="on">\r
734                 <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}/@{FILEPATH}" family="${PP_FAMILY}" \r
735                          dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">\r
736               <argument value="${VFRPP_FLAGS} ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
737                   <!-- Output file of the preprocess -->   \r
738                   <EXTRA.INC/>            \r
739                   <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>              \r
740                 </command>\r
741               </cc>\r
742             </then>\r
743           </if>\r
744           \r
745           \r
746           <vfrcompile createIfrBinFile="on" createListFile="on" outPutDir="${DEST_DIR_DEBUG}/@{FILEPATH}" vfrFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.i">\r
747             <EXTRA.INC/>\r
748           </vfrcompile>\r
749     \r
750           <cc userdefine="on">\r
751             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" \r
752                      includepathDelimiter="-I" family="${CC_FAMILY}" dpath="${CC_DPATH}"\r
753                      libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}"\r
754                      outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj" >\r
755               <argument value="${CC_FLAGS}"/>\r
756               <EXTRA.INC/>\r
757               <EXTRA.ARG/>\r
758               <fileset casesensitive="on" file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.c"/>\r
759             </command>\r
760           </cc>\r
761         </sequential>\r
762       </OnDependency>\r
763       <!-- Since fileset can't scan file start with ./, remove ./ in previous. -->\r
764       <if>\r
765         <equals arg1="@{FILEPATH}" arg2="." />\r
766         <then>\r
767           <var name="OBJECTS" value="${OBJECTS} @{FILENAME}.obj" />\r
768         </then>\r
769         <else>\r
770           <var name="OBJECTS" value="${OBJECTS} @{FILEPATH}/@{FILENAME}.obj" />\r
771         </else>\r
772       </if>\r
773     </sequential>\r
774   </macrodef>\r
775 \r
776   <!--\r
777       Build the real mode ASM file\r
778     -->\r
779   <macrodef name="Build_RealAsm">\r
780     <attribute name="FILEPATH"/>\r
781     <attribute name="FILENAME"/>\r
782     <attribute name="FILEEXT" default="asm"/>\r
783 \r
784     <element name="EXTRA.INC" optional="yes"/>\r
785     <element name="EXTRA.ARG" optional="yes"/>\r
786     \r
787     <sequential>\r
788       <OnDependency>\r
789         <sourcefiles>\r
790           <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
791         </sourcefiles>\r
792         <targetfiles>\r
793           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.cat"/>\r
794         </targetfiles>\r
795   \r
796         <sequential>\r
797           <exec dir="${DEST_DIR_OUTPUT}" executable="${ASM}" failonerror="true">\r
798             <arg line="/nologo /omf ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT} /Bl${ASMLINK} ${ASMLINK_FLAGS}"/>\r
799           </exec>\r
800           <concat destfile="${DEST_DIR_OUTPUT}/@{FILENAME}.cat" binary="yes">\r
801             <filelist dir="${MODULE_DIR}" files="Blank2.pad"/>\r
802             <filelist dir="${DEST_DIR_OUTPUT}" files="@{FILENAME}.com"/>\r
803           </concat>\r
804         </sequential>\r
805       </OnDependency>\r
806     </sequential>\r
807   </macrodef>\r
808 \r
809   <!--\r
810       Build Asl table file\r
811     -->\r
812   <macrodef name="Build_ASL">\r
813     <attribute name="FILEPATH"/>\r
814     <attribute name="FILENAME"/>\r
815     <attribute name="FILEEXT" default="asl"/>\r
816 \r
817     <element name="EXTRA.INC" optional="yes"/>\r
818     <element name="EXTRA.ARG" optional="yes"/>\r
819     \r
820     <sequential>\r
821       <mkdir dir="${DEST_DIR_OUTPUT}"/>\r
822 \r
823       <OnDependency>\r
824         <sourcefiles>\r
825           <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
826         </sourcefiles>\r
827         <targetfiles>\r
828           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>\r
829         </targetfiles>\r
830 \r
831         <sequential>\r
832           <cc userdefine="on">\r
833             <command type="PP" cmd="${PP}" workdir="${DEST_DIR_OUTPUT}" family="${PP_FAMILY}" \r
834                 dpath="${PP_DPATH}" libpath="${PP_LIBPATH}" include="${PP_INCLUDEPATH}">\r
835               <argument value="${APP_FLAGS}"/>\r
836               <EXTRA.INC/>              \r
837               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
838             </command>\r
839           </cc>\r
840 \r
841           <exec dir="${DEST_DIR_OUTPUT}" executable="${ASL}" failonerror="true" outputproperty="ASL_OUTPUT">\r
842             <arg line="${DEST_DIR_OUTPUT}/@{FILENAME}.i"/>\r
843           </exec>\r
844 \r
845           <if>\r
846             <or>\r
847               <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 2.0"/>\r
848               <contains string="${ASL_OUTPUT}" substring="Supports ACPI Specification Revision 1.0"/>\r
849             </or>\r
850             <then>\r
851               <fail message="Current Asl tool not support Acpi Spec 3.0. Pls update your Asl compiler."/>\r
852             </then>\r
853           </if>\r
854 \r
855           <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="aml"/>\r
856           \r
857         </sequential>\r
858       </OnDependency>\r
859     </sequential>\r
860   </macrodef>  \r
861 \r
862   <!--\r
863       Build Asl table c file\r
864     -->\r
865   <macrodef name="Build_CCASL">\r
866     <attribute name="FILEPATH"/>\r
867     <attribute name="FILENAME"/>\r
868     <attribute name="FILEEXT" default="c"/>\r
869 \r
870     <element name="EXTRA.INC" optional="yes"/>\r
871     <element name="EXTRA.ARG" optional="yes"/>\r
872     \r
873     <sequential>\r
874       <mkdir dir="${DEST_DIR_OUTPUT}"/>\r
875 \r
876       <OnDependency>\r
877         <sourcefiles>\r
878           <file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
879         </sourcefiles>\r
880         <targetfiles>\r
881           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>\r
882         </targetfiles>\r
883 \r
884         <sequential>\r
885 \r
886           <cc userdefine="on">\r
887             <command type="CC" cmd="${CC}" workdir="${DEST_DIR_OUTPUT}" family="${CC_FAMILY}"\r
888                 outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.obj" dpath="${CC_DPATH}" \r
889                 libpath="${CC_LIBPATH}" include="${CC_INCLUDEPATH}">\r
890               <EXTRA.INC/>\r
891               <argument value="${CC_FLAGS}"/>\r
892               <EXTRA.ARG/>\r
893               <fileset casesensitive="on" file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
894             </command>\r
895           </cc>\r
896 \r
897           <cc userdefine="on">\r
898             <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}" \r
899                      outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" dpath="${DLINK_DPATH}" >\r
900               <argument value="${SLINK_FLAGS}"/>\r
901               <fileset casesensitive="on" file="${DEST_DIR_OUTPUT}/@{FILENAME}.obj"/>\r
902             </command>\r
903           </cc>\r
904           \r
905           <genacpitable inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.exe" outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.acpi" />     \r
906      \r
907           <EFI_SECTION_RAW FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="acpi"/>\r
908         </sequential>\r
909       </OnDependency>\r
910     </sequential>\r
911   </macrodef> \r
912 \r
913   <!--\r
914     DUMMY\r
915     -->\r
916   <macrodef name="Build_DUMMY">\r
917     <attribute name="FILEPATH"/>\r
918     <attribute name="FILENAME"/>\r
919     <attribute name="FILEEXT"/>\r
920 \r
921     <element name="EXTRA.INC" optional="yes"/>\r
922     <element name="EXTRA.ARG" optional="yes"/>\r
923 \r
924     <sequential>\r
925       <!--echo message="Ignoring ${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" level="info" /-->\r
926     </sequential>\r
927   </macrodef>\r
928 \r
929 <!--############################################################################\r
930   Build Sections\r
931 #############################################################################-->\r
932   <!--\r
933     DLL\r
934     -->\r
935   <macrodef name="GenDll">\r
936     <attribute name="FILEPATH"/>\r
937     <attribute name="FILENAME"/>\r
938     <attribute name="FILEEXT"/>\r
939 \r
940     <element name="LIB.ARG" optional="yes"/>\r
941     <element name="LINK.ARG" optional="yes"/>\r
942 \r
943     <sequential>\r
944       <var name="FILE_BASENAME" value="@{FILENAME}" />\r
945       <var name="FILE_PATH" value="@{FILEPATH}" />\r
946       <OnDependency>\r
947         <sourcefiles>\r
948           <file list="${LIBS}"/>\r
949           <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />\r
950         </sourcefiles>\r
951         <targetfiles>\r
952           <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>\r
953         </targetfiles>\r
954 \r
955         <sequential>\r
956           <cc userdefine="on">\r
957             <command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"\r
958                 outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"\r
959                 libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">\r
960               <argument value="${SLINK_FLAGS}"/>\r
961 \r
962               <fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>\r
963             </command>\r
964           </cc>\r
965           <cc userdefine="on">\r
966             <command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"\r
967                      outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}" \r
968                      libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">\r
969               <argument value="${DLINK_FLAGS}"/>\r
970               <libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>\r
971               <LINK.ARG/>\r
972             </command>\r
973           </cc>\r
974         </sequential>\r
975       </OnDependency>\r
976     </sequential>\r
977   </macrodef>\r
978 \r
979   <!--\r
980     EFI\r
981     -->\r
982   <macrodef name="GenEfi">\r
983     <attribute name="FILEPATH"/>\r
984     <attribute name="FILENAME"/>\r
985     <attribute name="FILEEXT" default="dll"/>\r
986 \r
987     <sequential>\r
988       <OnDependency>\r
989         <sourcefiles>\r
990           <file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
991         </sourcefiles>\r
992         <targetfiles>\r
993           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>\r
994         </targetfiles>\r
995 \r
996         <sequential>\r
997           <fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" \r
998                    peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>\r
999         </sequential>\r
1000       </OnDependency>\r
1001     </sequential>\r
1002   </macrodef>\r
1003 \r
1004 <!--\r
1005   EFI_SECTION_FREEFORM_SUBTYPE_GUID\r
1006   EFI_SECTION_VERSION\r
1007   EFI_SECTION_USER_INTERFACE\r
1008   EFI_SECTION_DXE_DEPEX\r
1009   EFI_SECTION_PEI_DEPEX\r
1010   EFI_SECTION_PE32\r
1011   EFI_SECTION_PIC\r
1012   EFI_SECTION_TE\r
1013   EFI_SECTION_RAW\r
1014   EFI_SECTION_COMPRESSION\r
1015   EFI_SECTION_GUID_DEFINED\r
1016   EFI_SECTION_COMPATIBILITY16\r
1017   EFI_SECTION_FIRMWARE_VOLUME_IMAGE\r
1018   -->\r
1019   <!--\r
1020     EFI_SECTION_PE32\r
1021     -->\r
1022 \r
1023   <macrodef name="EFI_SECTION_TE">\r
1024     <attribute name="FILEPATH"/>\r
1025     <attribute name="FILENAME"/>\r
1026     <attribute name="FILEEXT" default="" />\r
1027 \r
1028     <element name="PRE.PROCESS" optional="yes"/>\r
1029     <element name="POST.PROCESS" optional="yes"/>\r
1030 \r
1031     <sequential>\r
1032       <PRE.PROCESS/>\r
1033       <if>\r
1034         <not>\r
1035           <equals arg1="${LIBS}" arg2=""/>\r
1036         </not>\r
1037 \r
1038         <then>\r
1039           <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">\r
1040             <LIB.ARG></LIB.ARG>\r
1041             <LINK.ARG></LINK.ARG>\r
1042           </GenDll>\r
1043 \r
1044           <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>\r
1045         </then>\r
1046       </if>\r
1047 \r
1048       <OnDependency>\r
1049         <sourcefiles>\r
1050           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>\r
1051         </sourcefiles>\r
1052         <targetfiles>\r
1053           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"/>\r
1054         </targetfiles>\r
1055 \r
1056         <sequential>\r
1057           <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />\r
1058           <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />          \r
1059           <genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>\r
1060           <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" \r
1061                       outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes" \r
1062                       sectiontype="EFI_SECTION_TE"/>\r
1063           <POST.PROCESS/>\r
1064         </sequential>\r
1065       </OnDependency>\r
1066     </sequential>\r
1067   </macrodef>\r
1068 \r
1069   <macrodef name="EFI_SECTION_PE32">\r
1070     <attribute name="FILEPATH"/>\r
1071     <attribute name="FILENAME"/>\r
1072     <attribute name="FILEEXT" default="" />\r
1073 \r
1074     <element name="PRE.PROCESS" optional="yes"/>\r
1075     <element name="POST.PROCESS" optional="yes"/>\r
1076 \r
1077     <sequential>\r
1078       <PRE.PROCESS/>\r
1079       <if>\r
1080         <not>\r
1081           <!-- TBD ${OBJECTS} -->\r
1082           <equals arg1="${LIBS}" arg2=""/>\r
1083         </not>\r
1084 \r
1085         <then>\r
1086           <GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">\r
1087             <LIB.ARG></LIB.ARG>\r
1088             <LINK.ARG></LINK.ARG>\r
1089           </GenDll>\r
1090 \r
1091           <GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>\r
1092         </then>\r
1093       </if>\r
1094       \r
1095       <OnDependency>\r
1096         <sourcefiles>\r
1097           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>\r
1098         </sourcefiles>\r
1099         <targetfiles>\r
1100           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"/>\r
1101         </targetfiles>\r
1102 \r
1103         <sequential>\r
1104           <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />\r
1105           <copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />\r
1106           <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" \r
1107                       outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32" \r
1108                       sectiontype="EFI_SECTION_PE32"/>\r
1109     \r
1110           <POST.PROCESS/>\r
1111         </sequential>\r
1112       </OnDependency>\r
1113     </sequential>\r
1114   </macrodef>\r
1115 \r
1116   <!--\r
1117     EFI_SECTION_VERSION\r
1118     -->\r
1119   <macrodef name="EFI_SECTION_VERSION">\r
1120     <attribute name="FILEPATH"/>\r
1121     <attribute name="FILENAME"/>\r
1122     <attribute name="FILEEXT" default="" />\r
1123     <attribute name="VERSION" default="0000"/>\r
1124 \r
1125     <element name="PRE.PROCESS" optional="yes"/>\r
1126     <element name="POST.PROCESS" optional="yes"/>\r
1127 \r
1128     <sequential>\r
1129       <if>\r
1130         <not>\r
1131           <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver"/>\r
1132         </not>\r
1133 \r
1134         <then>\r
1135           <PRE.PROCESS/>\r
1136           <gensection outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ver" \r
1137                       versionnum="@{VERSION}"\r
1138                       sectiontype="EFI_SECTION_VERSION"/>\r
1139           <POST.PROCESS/>\r
1140         </then>\r
1141       </if>\r
1142     </sequential>\r
1143   </macrodef>\r
1144 \r
1145   <!--\r
1146     EFI_SECTION_USER_INTERFACE\r
1147     -->\r
1148   <macrodef name="EFI_SECTION_USER_INTERFACE">\r
1149     <attribute name="FILEPATH"/>\r
1150     <attribute name="FILENAME"/>\r
1151     <attribute name="FILEEXT" default="" />\r
1152     <attribute name="UI" default="${BASE_NAME}"/>\r
1153 \r
1154     <element name="PRE.PROCESS" optional="yes"/>\r
1155     <element name="POST.PROCESS" optional="yes"/>\r
1156 \r
1157     <sequential>\r
1158       <if>\r
1159         <not>\r
1160           <available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui"/>\r
1161         </not>\r
1162 \r
1163         <then>\r
1164           <PRE.PROCESS/>\r
1165           <gensection interfacestring="@{UI}"\r
1166                       outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.ui" \r
1167                       sectiontype="EFI_SECTION_USER_INTERFACE"/>\r
1168           <POST.PROCESS/>\r
1169         </then>\r
1170       </if>\r
1171     </sequential>\r
1172   </macrodef>\r
1173 \r
1174   <!--\r
1175     EFI_SECTION_DXE_DEPEX\r
1176     -->\r
1177   <macrodef name="EFI_SECTION_DXE_DEPEX">\r
1178     <attribute name="FILEPATH"/>\r
1179     <attribute name="FILENAME"/>\r
1180     <attribute name="FILEEXT" default="dxs"/>\r
1181 \r
1182     <element name="PRE.PROCESS" optional="yes"/>\r
1183     <element name="POST.PROCESS" optional="yes"/>\r
1184 \r
1185     <sequential>\r
1186       <PRE.PROCESS/>\r
1187 \r
1188       <if>\r
1189         <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>\r
1190         <then>\r
1191           <OnDependency>\r
1192             <sourcefiles>\r
1193               <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>\r
1194             </sourcefiles>\r
1195             <targetfiles>\r
1196               <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>\r
1197             </targetfiles>\r
1198             <sequential>\r
1199               <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex" \r
1200                           outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx" \r
1201                           sectiontype="EFI_SECTION_DXE_DEPEX"/>\r
1202             </sequential>\r
1203           </OnDependency>\r
1204         </then>\r
1205         <else>\r
1206           <if>\r
1207             <not>\r
1208               <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>\r
1209             </not>\r
1210             <then>\r
1211               <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>\r
1212             </then>\r
1213           </if>\r
1214         </else>\r
1215       </if>\r
1216 \r
1217       <POST.PROCESS/>\r
1218     </sequential>\r
1219   </macrodef>\r
1220 \r
1221   <!--\r
1222     EFI_SECTION_PEI_DEPEX\r
1223     -->\r
1224   <macrodef name="EFI_SECTION_PEI_DEPEX">\r
1225     <attribute name="FILEPATH"/>\r
1226     <attribute name="FILENAME"/>\r
1227     <attribute name="FILEEXT" default="dxs"/>\r
1228 \r
1229     <element name="PRE.PROCESS" optional="yes"/>\r
1230     <element name="POST.PROCESS" optional="yes"/>\r
1231     <sequential>\r
1232       <PRE.PROCESS/>\r
1233       <if>\r
1234         <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>\r
1235         <then>\r
1236           <OnDependency>\r
1237             <sourcefiles>\r
1238               <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.depex"/>\r
1239             </sourcefiles>\r
1240             <targetfiles>\r
1241               <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>\r
1242             </targetfiles>\r
1243 \r
1244             <sequential>\r
1245               <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.depex" \r
1246                           outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx" \r
1247                           sectiontype="EFI_SECTION_PEI_DEPEX"/>\r
1248             </sequential>\r
1249           </OnDependency>\r
1250           \r
1251         </then>\r
1252         <else>\r
1253           <if>\r
1254             <not>\r
1255               <available type="file" file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>\r
1256             </not>\r
1257             <then>\r
1258               <touch file="${DEST_DIR_OUTPUT}/@{FILENAME}.dpx"/>\r
1259             </then>\r
1260           </if>\r
1261         </else>\r
1262       </if>\r
1263       <POST.PROCESS/>\r
1264     </sequential>\r
1265   </macrodef>\r
1266 \r
1267 \r
1268   <!--\r
1269     EFI_SECTION_RAW\r
1270     -->\r
1271   <macrodef name="EFI_SECTION_RAW">\r
1272     <attribute name="FILEPATH"/>\r
1273     <attribute name="FILENAME"/>\r
1274     <attribute name="FILEEXT" default="bin"/>\r
1275 \r
1276     <element name="PRE.PROCESS" optional="yes"/>\r
1277     <element name="POST.PROCESS" optional="yes"/>\r
1278 \r
1279     <sequential>\r
1280       <OnDependency>\r
1281         <sourcefiles>\r
1282           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
1283         </sourcefiles>\r
1284         <targetfiles>\r
1285           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>\r
1286         </targetfiles>\r
1287 \r
1288         <sequential>\r
1289           <PRE.PROCESS/>\r
1290           <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1291                       outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec" \r
1292                       sectiontype="EFI_SECTION_RAW"/>\r
1293           <POST.PROCESS/>\r
1294         </sequential>\r
1295       </OnDependency>\r
1296     </sequential>\r
1297   </macrodef>\r
1298 \r
1299   <!--\r
1300     EFI_SECTION_RAW_SEC\r
1301     -->\r
1302   <macrodef name="EFI_SECTION_RAW_SEC">\r
1303     <attribute name="FILEPATH"/>\r
1304     <attribute name="FILENAME"/>\r
1305     <attribute name="FILEEXT" default="cat"/>\r
1306 \r
1307     <element name="PRE.PROCESS" optional="yes"/>\r
1308     <element name="POST.PROCESS" optional="yes"/>\r
1309 \r
1310     <sequential>\r
1311       <OnDependency>\r
1312         <sourcefiles>\r
1313           <file name="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"/>\r
1314           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.te"/>\r
1315         </sourcefiles>\r
1316         <targetfiles>\r
1317           <file name="${DEST_DIR_OUTPUT}/@{FILENAME}.sec"/>\r
1318         </targetfiles>\r
1319 \r
1320         <sequential>\r
1321           <PRE.PROCESS/>\r
1322           <secfixup secexefile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" resetvectorDatafile="${DEST_DIR_OUTPUT}/ResetVec.@{FILEEXT}"\r
1323                    outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin"/>\r
1324                    \r
1325           <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.bin" \r
1326                       outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.sec" \r
1327                       sectiontype="EFI_SECTION_RAW"/>\r
1328           <POST.PROCESS/>\r
1329         </sequential>\r
1330       </OnDependency>\r
1331     </sequential>\r
1332   </macrodef>\r
1333   \r
1334   <!--\r
1335     EFI_SECTION_FIRMWARE_VOLUME_IMAGE\r
1336     -->\r
1337   <macrodef name="EFI_SECTION_FIRMWARE_VOLUME_IMAGE">\r
1338     <attribute name="FILEPATH"/>\r
1339     <attribute name="FILENAME"/>\r
1340     <attribute name="FILEEXT" default="fv"/>\r
1341 \r
1342     <element name="PRE.PROCESS" optional="yes"/>\r
1343     <element name="POST.PROCESS" optional="yes"/>\r
1344 \r
1345     <sequential>\r
1346       <OnDependency>\r
1347         <sourcefiles>\r
1348           <file name="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>\r
1349         </sourcefiles>\r
1350         <targetfiles>\r
1351           <file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec"/>\r
1352         </targetfiles>\r
1353 \r
1354         <sequential>\r
1355           <PRE.PROCESS/>\r
1356     \r
1357           <copy file="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1358                 tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1359                 overwrite="true"/>\r
1360           <gensection inputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1361                       outputfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}fv.sec" \r
1362                       sectiontype="EFI_SECTION_FIRMWARE_VOLUME_IMAGE"/>\r
1363     \r
1364           <POST.PROCESS/>\r
1365         </sequential>\r
1366       </OnDependency>\r
1367     </sequential>\r
1368   </macrodef>\r
1369 \r
1370   <!--\r
1371     Binary\r
1372     -->\r
1373   <macrodef name="Build_Binary">\r
1374     <attribute name="FILEPATH"/>\r
1375     <attribute name="FILENAME"/>\r
1376     <attribute name="FILEEXT" default="bin"/>\r
1377 \r
1378     <element name="EXTRA.INC" optional="yes"/>\r
1379     <element name="EXTRA.ARG" optional="yes"/>\r
1380 \r
1381     <sequential>\r
1382       <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1383             tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>\r
1384     </sequential>\r
1385   </macrodef>\r
1386   \r
1387   <!--\r
1388     Microcode\r
1389    -->\r
1390   <macrodef name="Build_MICROCODE">\r
1391     <attribute name="FILEPATH"/>\r
1392     <attribute name="FILENAME"/>\r
1393     <attribute name="FILEEXT" default="TXT"/>\r
1394 \r
1395     <element name="EXTRA.INC" optional="yes"/>\r
1396     <element name="EXTRA.ARG" optional="yes"/>\r
1397 \r
1398     <sequential>\r
1399       <mkdir dir="${TARGET_DIR}/Microcode"/>\r
1400       <flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>\r
1401     </sequential>\r
1402   </macrodef> \r
1403 \r
1404   <!--\r
1405     Graphics (bmp, ...)\r
1406     -->\r
1407   <macrodef name="Build_BMP">\r
1408     <attribute name="FILEPATH"/>\r
1409     <attribute name="FILENAME"/> \r
1410     <attribute name="FILEEXT" default="bmp"/>\r
1411 \r
1412     <element name="EXTRA.INC" optional="yes"/>\r
1413     <element name="EXTRA.ARG" optional="yes"/>\r
1414 \r
1415     <sequential>\r
1416       <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1417             tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>\r
1418     </sequential>\r
1419   </macrodef> \r
1420 \r
1421   <!--\r
1422     build EFI file\r
1423   -->\r
1424   <macrodef name="Build_EFI">\r
1425     <attribute name="FILEPATH"/>\r
1426     <attribute name="FILENAME"/>\r
1427     <attribute name="FILEEXT" default="efi"/>\r
1428 \r
1429     <element name="EXTRA.INC" optional="yes"/>\r
1430     <element name="EXTRA.ARG" optional="yes"/>\r
1431 \r
1432     <sequential>\r
1433       <mkdir dir="${MODULE_DIR}/@{FILEPATH}" /> \r
1434       <copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1435         tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>\r
1436     </sequential>\r
1437   </macrodef>\r
1438   \r
1439   <!-- \r
1440     Build macro for Apriori\r
1441   -->\r
1442   <macrodef name="Build_Apriori">\r
1443     <attribute name="FILEPATH" default="."/>\r
1444     <attribute name="FILENAME"/>\r
1445     <attribute name="FILEEXT" default="apr"/>\r
1446     <attribute name="GUID"/>\r
1447 \r
1448     <sequential>\r
1449       <mkdir dir="${FV_DIR}/Apriori" />\r
1450       <gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" \r
1451                   outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec" \r
1452                   sectiontype="EFI_SECTION_RAW"/>\r
1453 \r
1454       <genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM" \r
1455                   fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">\r
1456         <sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>\r
1457       </genffsfile>\r
1458       \r
1459     </sequential>\r
1460   </macrodef>\r
1461 </project>\r