BaseTools:added extern protocol/PPI/GUID definition in AutoGen for Library

We already added the extern declaration for protocols/PPI/GUID in AutoGen.h
file for driver, but missing this feature for the Library. so this patch
add it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18661 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Yonghong Zhu 2015-10-26 03:26:55 +00:00 committed by yzhu52
parent 9382b53a23
commit 7beed8a3da

View File

@ -1384,22 +1384,21 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file
#
def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.IsLibrary:
return
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
GuidType = "GUID"
else:
GuidType = "EFI_GUID"
if Info.GuidList:
AutoGenC.Append("\n// Guids\n")
if not Info.IsLibrary:
AutoGenC.Append("\n// Guids\n")
AutoGenH.Append("\n// Guids\n")
#
# GUIDs
#
for Key in Info.GuidList:
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))
if not Info.IsLibrary:
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.GuidList[Key]))
AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
## Create code for protocol
@ -1409,22 +1408,21 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file
#
def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.IsLibrary:
return
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
GuidType = "GUID"
else:
GuidType = "EFI_GUID"
if Info.ProtocolList:
AutoGenC.Append("\n// Protocols\n")
if not Info.IsLibrary:
AutoGenC.Append("\n// Protocols\n")
AutoGenH.Append("\n// Protocols\n")
#
# Protocol GUIDs
#
for Key in Info.ProtocolList:
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))
if not Info.IsLibrary:
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.ProtocolList[Key]))
AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
## Create code for PPI
@ -1434,22 +1432,21 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH):
# @param AutoGenH The TemplateString object for header file
#
def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
if Info.IsLibrary:
return
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
GuidType = "GUID"
else:
GuidType = "EFI_GUID"
if Info.PpiList:
AutoGenC.Append("\n// PPIs\n")
if not Info.IsLibrary:
AutoGenC.Append("\n// PPIs\n")
AutoGenH.Append("\n// PPIs\n")
#
# PPI GUIDs
#
for Key in Info.PpiList:
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))
if not Info.IsLibrary:
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED %s %s = %s;\n' % (GuidType, Key, Info.PpiList[Key]))
AutoGenH.Append('extern %s %s;\n' % (GuidType, Key))
## Create code for PCD