From 42b787576f05b9cad1a07db5d0cc4d565c7e8d13 Mon Sep 17 00:00:00 2001 From: qouyang Date: Mon, 10 Jul 2006 06:19:15 +0000 Subject: [PATCH] Fixed EdkT35, EdkT89. Fixed the "#ifndef _AUTOGENH_" issue when the moduleBase name include the whiteSpace. Change "#ifndef {moduleBaseName}__AUTOGENH" to "ifndef _AUTOGENH_${MoudleGuild}". git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@856 6f19259b-4bc3-4df7-8a09-765794883524 --- .../org/tianocore/build/GenBuildTask.java | 2 +- .../org/tianocore/build/autogen/AutoGen.java | 22 ++++++++----------- .../build/autogen/AutogenLibOrder.java | 4 ++-- .../build/global/SurfaceAreaQuery.java | 20 ++++++++++++----- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java index 6dd0a4fff0..bc484a29e4 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java @@ -158,7 +158,7 @@ public class GenBuildTask extends Ant { SurfaceAreaQuery.setDoc(doc); moduleId = SurfaceAreaQuery.getMsaHeader(); } - String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); + String[] producedLibraryClasses = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED",null); if (producedLibraryClasses.length == 0) { moduleId.setLibrary(false); } diff --git a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java index 300433081d..3aff06f956 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java +++ b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java @@ -251,10 +251,8 @@ public class AutoGen { // Add #ifndef ${BaseName}_AUTOGENH // #def ${BseeName}_AUTOGENH // - fileBuffer.append("#ifndef " + this.moduleId.getName().toUpperCase() - + "_AUTOGENH\r\n"); - fileBuffer.append("#define " + this.moduleId.getName().toUpperCase() - + "_AUTOGENH\r\n\r\n"); + fileBuffer.append("#ifndef " + "_AUTOGENH_" + this.moduleId.getGuid().replaceAll("-", "_") +"\r\n"); + fileBuffer.append("#define " + "_AUTOGENH_" + this.moduleId.getGuid().replaceAll("-", "_") +"\r\n\r\n"); // // Write the specification version and release version at the begine @@ -298,7 +296,7 @@ public class AutoGen { // Write library class's related *.h file to autogen.h. // String[] libClassList = SurfaceAreaQuery - .getLibraryClasses(CommonDefinition.AlwaysConsumed); + .getLibraryClasses(CommonDefinition.AlwaysConsumed,this.arch); if (libClassList != null) { libClassIncludeH = LibraryClassToAutogenH(libClassList); item = libClassIncludeH.iterator(); @@ -308,7 +306,7 @@ public class AutoGen { } libClassList = SurfaceAreaQuery - .getLibraryClasses(CommonDefinition.AlwaysProduced); + .getLibraryClasses(CommonDefinition.AlwaysProduced, this.arch); if (libClassList != null) { libClassIncludeH = LibraryClassToAutogenH(libClassList); item = libClassIncludeH.iterator(); @@ -493,10 +491,8 @@ public class AutoGen { // Add #ifndef ${BaseName}_AUTOGENH // #def ${BseeName}_AUTOGENH // - fileBuffer.append("#ifndef " + this.moduleId.getName().toUpperCase() - + "_AUTOGENH\r\n"); - fileBuffer.append("#define " + this.moduleId.getName().toUpperCase() - + "_AUTOGENH\r\n\r\n"); + fileBuffer.append("#ifndef " + "_AUTOGENH_" + this.moduleId.getGuid().replaceAll("-", "_") + "\r\n"); + fileBuffer.append("#define " + "_AUTOGENH_" + this.moduleId.getGuid().replaceAll("-", "_") + "\r\n\r\n"); // // Write EFI_SPECIFICATION_VERSION and EDK_RELEASE_VERSION @@ -528,7 +524,7 @@ public class AutoGen { // Write library class's related *.h file to autogen.h // String[] libClassList = SurfaceAreaQuery - .getLibraryClasses(CommonDefinition.AlwaysConsumed); + .getLibraryClasses(CommonDefinition.AlwaysConsumed, this.arch); if (libClassList != null) { libClassIncludeH = LibraryClassToAutogenH(libClassList); item = libClassIncludeH.iterator(); @@ -538,7 +534,7 @@ public class AutoGen { } libClassList = SurfaceAreaQuery - .getLibraryClasses(CommonDefinition.AlwaysProduced); + .getLibraryClasses(CommonDefinition.AlwaysProduced, this.arch); if (libClassList != null) { libClassIncludeH = LibraryClassToAutogenH(libClassList); item = libClassIncludeH.iterator(); @@ -1772,7 +1768,7 @@ public class AutoGen { if (compDiagList != null && compDiagList.length != 0) { if (drvBindList.length != compDiagList.length) { throw new BuildException( - "Different number of Driver Binding and Driver Configuration protocols!"); + "Different number of Driver Binding and Driver Diagnosis protocols!"); } BitMask |= 0x04; diff --git a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java index f08fec70e7..5ab585c471 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java +++ b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutogenLibOrder.java @@ -76,7 +76,7 @@ public class AutogenLibOrder { // libInstanceMap. // libClassConsmList = SurfaceAreaQuery - .getLibraryClasses(CommonDefinition.AlwaysConsumed); + .getLibraryClasses(CommonDefinition.AlwaysConsumed, arch); if (libClassConsmList != null) { String[] classStr = new String[libClassConsmList.length]; for (int k = 0; k < libClassConsmList.length; k++) { @@ -95,7 +95,7 @@ public class AutogenLibOrder { // Add library class and library instance map. // libClassDeclList = SurfaceAreaQuery - .getLibraryClasses(CommonDefinition.AlwaysProduced); + .getLibraryClasses(CommonDefinition.AlwaysProduced, arch); if (libClassDeclList != null) { for (int j = 0; j < libClassDeclList.length; j++) { if (this.libClassMap.containsKey(libClassDeclList[j])) { diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index 235c604eb3..321a87a827 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -598,9 +598,8 @@ public class SurfaceAreaQuery { * xpath * @returns null if nothing is there */ - public static String[] getLibraryClasses(String usage) { + public static String[] getLibraryClasses(String usage, String arch) { String[] xPath; - if (usage == null || usage.equals("")) { xPath = new String[] { "/LibraryClass" }; } else { @@ -613,11 +612,19 @@ public class SurfaceAreaQuery { } LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns; - String[] libraryClassName = new String[libraryClassList.length]; + List libraryClassName = new ArrayList(); for (int i = 0; i < libraryClassList.length; i++) { - libraryClassName[i] = libraryClassList[i].getKeyword(); + List archList = libraryClassList[i].getSupArchList(); + + if (arch == null || contains(archList, arch)) { + libraryClassName.add(libraryClassList[i].getKeyword()); + } } - return libraryClassName; + String[] libraryArray = new String[libraryClassName.size()]; + for (int i = 0; i < libraryClassName.size(); i++) { + libraryArray[i] = libraryClassName.get(i); + } + return libraryArray; } /** @@ -1885,6 +1892,9 @@ public class SurfaceAreaQuery { @return boolean **/ public static boolean contains(List list, String str) { + if (list == null || list.size()== 0) { + return true; + } Iterator it = list.iterator(); while (it.hasNext()) { String s = (String)it.next(); -- 2.39.2