Translate the Arch enum to an arch directory name. This is necessary for Linux builds...
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / GenBuildTask.java
index 2d91991..2d3318d 100644 (file)
@@ -237,8 +237,8 @@ public class GenBuildTask extends Task {
         // Update flags like CC_FLAGS, LIB_FLAGS etc.\r
         //\r
         flagsSetup();\r
-        GlobalData.addLibrary(baseName, getProject().getProperty("BIN_DIR") + File.separatorChar + baseName + ".lib");\r
-        GlobalData.addModuleLibrary(baseName, libraries);\r
+        GlobalData.addLibrary(baseName, arch, getProject().getProperty("BIN_DIR") + File.separatorChar + baseName + ".lib");\r
+        GlobalData.addModuleLibrary(baseName, arch, libraries);\r
         //\r
         // If ComponentType is USER_DEFINED,\r
         // then call the exist BaseName_build.xml directly.\r
@@ -267,6 +267,20 @@ public class GenBuildTask extends Task {
         ant.execute();\r
     }\r
 \r
+    /**\r
+      Return the name of the directory that corresponds to the architecture.\r
+      This is a translation from the XML Schema tag to a directory that\r
+      corresponds to our directory name coding convention.\r
+     \r
+    **/\r
+    private String archDir(String arch) {\r
+        return arch.replaceFirst("X64", "x64")\r
+                   .replaceFirst("IPF", "Ipf")\r
+                   .replaceFirst("IA32", "Ia32")\r
+                   .replaceFirst("ARM", "Arm")\r
+                   .replaceFirst("EBC", "Ebc");\r
+    }\r
+\r
     /**\r
       Get the dependent library instances and include package name from \r
       surface area, and initialize module include pathes. \r
@@ -281,7 +295,7 @@ public class GenBuildTask extends Task {
                 includes.add("${WORKSPACE_DIR}" + File.separatorChar + GlobalData.getPackagePath(packageName)\r
                              + File.separatorChar + "Include");\r
                 includes.add("${WORKSPACE_DIR}" + File.separatorChar + GlobalData.getPackagePath(packageName)\r
-                             + File.separatorChar + "Include" + File.separatorChar + "${ARCH}");\r
+                             + File.separatorChar + "Include" + File.separatorChar + archDir(arch));\r
             }\r
         }\r
         includes.add("${DEST_DIR_DEBUG}");\r