- Fixed PVCS tracker 484 by merging the GenDll and GenEfi macro in BuildMacro.xml...
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / ModuleBuildFileGenerator.java
index 4f038ae25beda0c971fad31ea8e743b8e2f7e629..bbb51cd93f00658c52b2e959ee92acc9896cf36f 100644 (file)
@@ -371,19 +371,24 @@ public class ModuleBuildFileGenerator {
 \r
         FileProcess fileProcess = new FileProcess();\r
         fileProcess.init(project, includes, document);\r
-        \r
-        //\r
-        // Initialize some properties by user\r
-        //\r
-        Element initEle = document.createElement("Build_Init");\r
-        Element initIncEle = document.createElement("EXTRA.INC");\r
-        for (int i = 0; i < includes.length; i++) {\r
-            Element includeEle = document.createElement("includepath");\r
-            includeEle.setAttribute("path", includes[i]);\r
-            initIncEle.appendChild(includeEle);\r
+\r
+        boolean isBinaryModule  = fpdModuleId.getModule().isBinary();\r
+        boolean isLibraryModule = fpdModuleId.getModule().isLibrary();\r
+\r
+        if (!isBinaryModule) {\r
+            //\r
+            // Initialize some properties by user\r
+            //\r
+            Element initEle = document.createElement("Build_Init");\r
+            Element initIncEle = document.createElement("EXTRA.INC");\r
+            for (int i = 0; i < includes.length; i++) {\r
+                Element includeEle = document.createElement("includepath");\r
+                includeEle.setAttribute("path", includes[i]);\r
+                initIncEle.appendChild(includeEle);\r
+            }\r
+            initEle.appendChild(initIncEle);\r
+            root.appendChild(initEle);\r
         }\r
-        initEle.appendChild(initIncEle);\r
-        root.appendChild(initEle);\r
 \r
         String moduleDir = project.getProperty("MODULE_DIR");\r
         //\r
@@ -421,10 +426,9 @@ public class ModuleBuildFileGenerator {
         }\r
 \r
         //\r
-        // Parse AutoGen.c & AutoGen.h\r
+        // Don't build AutoGen.c for library and binary module\r
         //\r
-        if (!fpdModuleId.getModule().isLibrary()\r
-            && !fpdModuleId.getModule().isBinary()) {\r
+        if (!isLibraryModule && !isBinaryModule) {\r
             fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false);\r
         }\r
         \r
@@ -470,6 +474,18 @@ public class ModuleBuildFileGenerator {
                 if (sectiontype.equalsIgnoreCase("EFI_SECTION_RAW") && project.getProperty("MODULE_TYPE").equalsIgnoreCase("SEC")) {\r
                     sectiontype += "_SEC";\r
                 }\r
+                if ((sectiontype.equalsIgnoreCase("EFI_SECTION_PE32") || \r
+                     sectiontype.equalsIgnoreCase("EFI_SECTION_TE"))\r
+                    && !fpdModuleId.getModule().isLibrary()\r
+                    && !fpdModuleId.getModule().isBinary()) {\r
+                    //\r
+                    // Generate code to generate efi file\r
+                    // \r
+                    Element ele = document.createElement("GenEfi");\r
+                    ele.setAttribute("FILEPATH", ".");\r
+                    ele.setAttribute("FILENAME", "${BASE_NAME}");\r
+                    root.appendChild(ele);\r
+                }\r
                 Element ele = document.createElement(sectiontype);\r
                 ele.setAttribute("FILEPATH", ".");\r
                 ele.setAttribute("FILENAME", "${BASE_NAME}");\r