- Move global declarations from AutoGen.c to AutoGen.h

- Stop building AutoGen.c for binary module

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2331 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2007-01-29 04:41:58 +00:00
parent c111036f20
commit 2c9b03f219
5 changed files with 53 additions and 15 deletions

View File

@ -207,6 +207,7 @@ public class GenBuildTask extends Ant {
} else { } else {
moduleId.setLibrary(true); moduleId.setLibrary(true);
} }
moduleId.setBinary(saq.getBinaryModule());
// //
// Judge whether it is single module build or not // Judge whether it is single module build or not

View File

@ -424,7 +424,7 @@ public class ModuleBuildFileGenerator {
// Parse AutoGen.c & AutoGen.h // Parse AutoGen.c & AutoGen.h
// //
if (!fpdModuleId.getModule().isLibrary() if (!fpdModuleId.getModule().isLibrary()
&& !fpdModuleId.getModule().getName().equalsIgnoreCase("Shell")) { && !fpdModuleId.getModule().isBinary()) {
fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false); fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false);
} }

View File

@ -120,6 +120,7 @@ public class AutoGen {
private List<String> exitBootServiceList = new ArrayList<String>(); private List<String> exitBootServiceList = new ArrayList<String>();
private StringBuffer functionDeclarations = new StringBuffer(10240); private StringBuffer functionDeclarations = new StringBuffer(10240);
private StringBuffer globalDeclarations = new StringBuffer(10240);
// //
// flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable // flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable
@ -384,6 +385,7 @@ public class AutoGen {
fileBuffer.append(this.myPcdAutogen.getHAutoGenString()); fileBuffer.append(this.myPcdAutogen.getHAutoGenString());
} }
fileBuffer.append(globalDeclarations);
fileBuffer.append(functionDeclarations); fileBuffer.append(functionDeclarations);
// //
// Append the #endif at AutoGen.h // Append the #endif at AutoGen.h
@ -1798,9 +1800,9 @@ public class AutoGen {
// //
for (int i = 0; i < driverBindingGroup.length; i++) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][0] != null) {
fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL "); globalDeclarations.append("extern EFI_DRIVER_BINDING_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][0]); globalDeclarations.append(driverBindingGroup[i][0]);
fileBuffer.append(";\r\n"); globalDeclarations.append(";\r\n");
} }
} }
@ -1812,9 +1814,9 @@ public class AutoGen {
if (driverBindingGroup[i][1]!= null) { if (driverBindingGroup[i][1]!= null) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][0] != null) {
BitMask |= 0x01; BitMask |= 0x01;
fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL "); globalDeclarations.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][1]); globalDeclarations.append(driverBindingGroup[i][1]);
fileBuffer.append(";\r\n"); globalDeclarations.append(";\r\n");
} else { } else {
throw new AutoGenException("DriverBinding can't be empty!!"); throw new AutoGenException("DriverBinding can't be empty!!");
} }
@ -1829,9 +1831,9 @@ public class AutoGen {
if (driverBindingGroup[i][2] != null) { if (driverBindingGroup[i][2] != null) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][0] != null) {
BitMask |= 0x02; BitMask |= 0x02;
fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL "); globalDeclarations.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][2]); globalDeclarations.append(driverBindingGroup[i][2]);
fileBuffer.append(";\r\n"); globalDeclarations.append(";\r\n");
} else { } else {
throw new AutoGenException("DriverBinding can't be empty!!"); throw new AutoGenException("DriverBinding can't be empty!!");
} }
@ -1846,9 +1848,9 @@ public class AutoGen {
if (driverBindingGroup[i][3] != null) { if (driverBindingGroup[i][3] != null) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][0] != null) {
BitMask |= 0x04; BitMask |= 0x04;
fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL "); globalDeclarations.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][3]); globalDeclarations.append(driverBindingGroup[i][3]);
fileBuffer.append(";\r\n"); globalDeclarations.append(";\r\n");
} else { } else {
throw new AutoGenException("DriverBinding can't be empty!!"); throw new AutoGenException("DriverBinding can't be empty!!");
} }

View File

@ -23,11 +23,12 @@ import java.util.Stack;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.tianocore.ExternsDocument.Externs.Extern;
import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlString; import org.apache.xmlbeans.XmlString;
import org.tianocore.*; import org.tianocore.*;
import org.tianocore.ExternsDocument.Externs.Extern;
import org.tianocore.FilenameDocument.Filename; import org.tianocore.FilenameDocument.Filename;
import org.tianocore.ModuleDefinitionsDocument.ModuleDefinitions;
import org.tianocore.MsaHeaderDocument.MsaHeader; import org.tianocore.MsaHeaderDocument.MsaHeader;
import org.tianocore.ProtocolsDocument.Protocols.Protocol; import org.tianocore.ProtocolsDocument.Protocols.Protocol;
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify; import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
@ -37,8 +38,8 @@ import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification; import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification; import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.toolchain.ToolChainInfo; import org.tianocore.build.toolchain.ToolChainInfo;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.definitions.EdkDefinitions; import org.tianocore.common.definitions.EdkDefinitions;
import org.tianocore.common.exception.EdkException;
import org.w3c.dom.Node; import org.w3c.dom.Node;
/** /**
@ -543,6 +544,24 @@ public class SurfaceAreaQuery {
return null; return null;
} }
/**
* Retrieve <ModuleDefinitions>/<BinaryModule>
*
* @returns The module type name if elements are found at the known xpath
* @returns null if nothing is there
*/
public boolean getBinaryModule() {
String[] xPath = new String[] { "/" };
Object[] returns = get("ModuleDefinitions", xPath);
if (returns != null && returns.length > 0) {
ModuleDefinitionsDocument.ModuleDefinitions def = (ModuleDefinitionsDocument.ModuleDefinitions)returns[0];
return def.getBinaryModule();
}
return false;
}
/** /**
* Retrieve PackageDependencies/Package * Retrieve PackageDependencies/Package
* *

View File

@ -31,6 +31,8 @@ public class ModuleIdentification extends Identification {
private boolean isLibrary = false; private boolean isLibrary = false;
private boolean isBinary = false;
private String constructor = ""; private String constructor = "";
private String destructor = ""; private String destructor = "";
@ -87,6 +89,20 @@ public class ModuleIdentification extends Identification {
this.isLibrary = isLibrary; this.isLibrary = isLibrary;
} }
/**
@return boolean is this module is binary
**/
public boolean isBinary() {
return isBinary;
}
/**
@param isBinary
**/
public void setBinary(boolean isBinary) {
this.isBinary = isBinary;
}
/** /**
@return MSA File @return MSA File
**/ **/