mirror of https://github.com/acidanthera/audk.git
BaseTools: not include the undefined macro in response file
In last Nmake patch, when we generate the response file, we would replace all the Macros in the make file. Once there have undefined macro used, the tool direct report error. In this patch, we use following solution to resolve the failure. 1. Add all the defined macros into AutoGenObject macro dict 2. For the undefined macros which used in the Make file, when we generate the response file, we not include this macro, let make phase to handle. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
c7d1e742ec
commit
3570e33248
|
@ -2480,6 +2480,12 @@ class ModuleAutoGen(AutoGen):
|
|||
self._Macro["DEBUG_DIR" ] = self.DebugDir
|
||||
self._Macro["DEST_DIR_OUTPUT" ] = self.OutputDir
|
||||
self._Macro["DEST_DIR_DEBUG" ] = self.DebugDir
|
||||
self._Macro["PLATFORM_NAME" ] = self.PlatformInfo.Name
|
||||
self._Macro["PLATFORM_GUID" ] = self.PlatformInfo.Guid
|
||||
self._Macro["PLATFORM_VERSION" ] = self.PlatformInfo.Version
|
||||
self._Macro["PLATFORM_RELATIVE_DIR" ] = self.PlatformInfo.SourceDir
|
||||
self._Macro["PLATFORM_DIR" ] = mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir)
|
||||
self._Macro["PLATFORM_OUTPUT_DIR" ] = self.PlatformInfo.OutputDir
|
||||
return self._Macro
|
||||
|
||||
## Return the module build data object
|
||||
|
|
|
@ -477,6 +477,17 @@ cleanlib:
|
|||
# EdkII modules always use "_ModuleEntryPoint" as entry point
|
||||
ImageEntryPoint = "_ModuleEntryPoint"
|
||||
|
||||
for k, v in self._AutoGenObject.Module.Defines.iteritems():
|
||||
if k not in self._AutoGenObject.Macros.keys():
|
||||
self._AutoGenObject.Macros[k] = v
|
||||
|
||||
if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
|
||||
self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint
|
||||
if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
|
||||
self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint
|
||||
if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():
|
||||
self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint
|
||||
|
||||
# tools definitions
|
||||
ToolsDef = []
|
||||
IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]
|
||||
|
@ -504,10 +515,20 @@ cleanlib:
|
|||
RespFileListContent = ''
|
||||
for Resp in RespDict.keys():
|
||||
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')
|
||||
SaveFileOnChange(RespFile, RespDict[Resp], False)
|
||||
ToolsDef.append("%s = %s" % (Resp, '@' + RespFile))
|
||||
StrList = RespDict[Resp].split(' ')
|
||||
UnexpandMacro = []
|
||||
NewStr = []
|
||||
for Str in StrList:
|
||||
if '$' in Str:
|
||||
UnexpandMacro.append(Str)
|
||||
else:
|
||||
NewStr.append(Str)
|
||||
UnexpandMacroStr = ' '.join(UnexpandMacro)
|
||||
NewRespStr = ' '.join(NewStr)
|
||||
SaveFileOnChange(RespFile, NewRespStr, False)
|
||||
ToolsDef.append("%s = %s" % (Resp, UnexpandMacroStr + ' @' + RespFile))
|
||||
RespFileListContent += '@' + RespFile + os.linesep
|
||||
RespFileListContent += RespDict[Resp] + os.linesep
|
||||
RespFileListContent += NewRespStr + os.linesep
|
||||
SaveFileOnChange(RespFileList, RespFileListContent, False)
|
||||
else:
|
||||
if os.path.exists(RespFileList):
|
||||
|
@ -678,6 +699,10 @@ cleanlib:
|
|||
for item in SingleCommandList[1:]:
|
||||
if FlagDict[Tool]['Macro'] in item:
|
||||
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']
|
||||
for Option in self._AutoGenObject.BuildOption.keys():
|
||||
for Attr in self._AutoGenObject.BuildOption[Option]:
|
||||
if Str.find(Option + '_' + Attr) != -1:
|
||||
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
|
||||
while(Str.find('$(') != -1):
|
||||
for macro in self._AutoGenObject.Macros.keys():
|
||||
MacroName = '$('+ macro + ')'
|
||||
|
@ -685,7 +710,7 @@ cleanlib:
|
|||
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])
|
||||
break
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, ExtraData="[%s]" % str(self._AutoGenObject))
|
||||
break
|
||||
SingleCommandLength += len(Str)
|
||||
elif '$(INC)' in item:
|
||||
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)
|
||||
|
@ -702,8 +727,7 @@ cleanlib:
|
|||
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])
|
||||
break
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, ExtraData="[%s]" % str(self._AutoGenObject))
|
||||
|
||||
break
|
||||
SingleCommandLength += len(Str)
|
||||
|
||||
if SingleCommandLength > GlobalData.gCommandMaxLength:
|
||||
|
@ -717,6 +741,10 @@ cleanlib:
|
|||
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']
|
||||
for inc in self._AutoGenObject._IncludePathList:
|
||||
Value += ' ' + IncPrefix + inc
|
||||
for Option in self._AutoGenObject.BuildOption.keys():
|
||||
for Attr in self._AutoGenObject.BuildOption[Option]:
|
||||
if Value.find(Option + '_' + Attr) != -1:
|
||||
Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])
|
||||
while (Value.find('$(') != -1):
|
||||
for macro in self._AutoGenObject.Macros.keys():
|
||||
MacroName = '$('+ macro + ')'
|
||||
|
@ -724,7 +752,7 @@ cleanlib:
|
|||
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])
|
||||
break
|
||||
else:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, ExtraData="[%s]" % str(self._AutoGenObject))
|
||||
break
|
||||
RespDict[Key] = Value
|
||||
for Target in BuildTargets:
|
||||
for i, SingleCommand in enumerate(BuildTargets[Target].Commands):
|
||||
|
|
Loading…
Reference in New Issue