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>
self._Macro["DEBUG_DIR" ] = self.DebugDir\r
self._Macro["DEST_DIR_OUTPUT" ] = self.OutputDir\r
self._Macro["DEST_DIR_DEBUG" ] = self.DebugDir\r
self._Macro["DEBUG_DIR" ] = self.DebugDir\r
self._Macro["DEST_DIR_OUTPUT" ] = self.OutputDir\r
self._Macro["DEST_DIR_DEBUG" ] = self.DebugDir\r
+ self._Macro["PLATFORM_NAME" ] = self.PlatformInfo.Name\r
+ self._Macro["PLATFORM_GUID" ] = self.PlatformInfo.Guid\r
+ self._Macro["PLATFORM_VERSION" ] = self.PlatformInfo.Version\r
+ self._Macro["PLATFORM_RELATIVE_DIR" ] = self.PlatformInfo.SourceDir\r
+ self._Macro["PLATFORM_DIR" ] = mws.join(self.WorkspaceDir, self.PlatformInfo.SourceDir)\r
+ self._Macro["PLATFORM_OUTPUT_DIR" ] = self.PlatformInfo.OutputDir\r
return self._Macro\r
\r
## Return the module build data object\r
return self._Macro\r
\r
## Return the module build data object\r
# EdkII modules always use "_ModuleEntryPoint" as entry point\r
ImageEntryPoint = "_ModuleEntryPoint"\r
\r
# EdkII modules always use "_ModuleEntryPoint" as entry point\r
ImageEntryPoint = "_ModuleEntryPoint"\r
\r
+ for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
+ if k not in self._AutoGenObject.Macros.keys():\r
+ self._AutoGenObject.Macros[k] = v\r
+\r
+ if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint\r
+ if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint\r
+ if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
+\r
# tools definitions\r
ToolsDef = []\r
IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]\r
# tools definitions\r
ToolsDef = []\r
IncPrefix = self._INC_FLAG_[self._AutoGenObject.ToolChainFamily]\r
RespFileListContent = ''\r
for Resp in RespDict.keys():\r
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')\r
RespFileListContent = ''\r
for Resp in RespDict.keys():\r
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')\r
- SaveFileOnChange(RespFile, RespDict[Resp], False)\r
- ToolsDef.append("%s = %s" % (Resp, '@' + RespFile))\r
+ StrList = RespDict[Resp].split(' ')\r
+ UnexpandMacro = []\r
+ NewStr = []\r
+ for Str in StrList:\r
+ if '$' in Str:\r
+ UnexpandMacro.append(Str)\r
+ else:\r
+ NewStr.append(Str)\r
+ UnexpandMacroStr = ' '.join(UnexpandMacro)\r
+ NewRespStr = ' '.join(NewStr)\r
+ SaveFileOnChange(RespFile, NewRespStr, False)\r
+ ToolsDef.append("%s = %s" % (Resp, UnexpandMacroStr + ' @' + RespFile))\r
RespFileListContent += '@' + RespFile + os.linesep\r
RespFileListContent += '@' + RespFile + os.linesep\r
- RespFileListContent += RespDict[Resp] + os.linesep\r
+ RespFileListContent += NewRespStr + os.linesep\r
SaveFileOnChange(RespFileList, RespFileListContent, False)\r
else:\r
if os.path.exists(RespFileList):\r
SaveFileOnChange(RespFileList, RespFileListContent, False)\r
else:\r
if os.path.exists(RespFileList):\r
for item in SingleCommandList[1:]:\r
if FlagDict[Tool]['Macro'] in item:\r
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']\r
for item in SingleCommandList[1:]:\r
if FlagDict[Tool]['Macro'] in item:\r
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']\r
+ for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Attr in self._AutoGenObject.BuildOption[Option]:\r
+ if Str.find(Option + '_' + Attr) != -1:\r
+ Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
for macro in self._AutoGenObject.Macros.keys():\r
MacroName = '$('+ macro + ')'\r
while(Str.find('$(') != -1):\r
for macro in self._AutoGenObject.Macros.keys():\r
MacroName = '$('+ macro + ')'\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
break\r
else:\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
break\r
else:\r
- EdkLogger.error("build", AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, ExtraData="[%s]" % str(self._AutoGenObject))\r
SingleCommandLength += len(Str)\r
elif '$(INC)' in item:\r
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)\r
SingleCommandLength += len(Str)\r
elif '$(INC)' in item:\r
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
break\r
else:\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
break\r
else:\r
- EdkLogger.error("build", AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, ExtraData="[%s]" % str(self._AutoGenObject))\r
-\r
SingleCommandLength += len(Str)\r
\r
if SingleCommandLength > GlobalData.gCommandMaxLength:\r
SingleCommandLength += len(Str)\r
\r
if SingleCommandLength > GlobalData.gCommandMaxLength:\r
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']\r
for inc in self._AutoGenObject._IncludePathList:\r
Value += ' ' + IncPrefix + inc\r
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']\r
for inc in self._AutoGenObject._IncludePathList:\r
Value += ' ' + IncPrefix + inc\r
+ for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Attr in self._AutoGenObject.BuildOption[Option]:\r
+ if Value.find(Option + '_' + Attr) != -1:\r
+ Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while (Value.find('$(') != -1):\r
for macro in self._AutoGenObject.Macros.keys():\r
MacroName = '$('+ macro + ')'\r
while (Value.find('$(') != -1):\r
for macro in self._AutoGenObject.Macros.keys():\r
MacroName = '$('+ macro + ')'\r
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])\r
break\r
else:\r
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])\r
break\r
else:\r
- EdkLogger.error("build", AUTOGEN_ERROR, "Not supported macro is found in make command : %s" % Str, ExtraData="[%s]" % str(self._AutoGenObject))\r
RespDict[Key] = Value\r
for Target in BuildTargets:\r
for i, SingleCommand in enumerate(BuildTargets[Target].Commands):\r
RespDict[Key] = Value\r
for Target in BuildTargets:\r
for i, SingleCommand in enumerate(BuildTargets[Target].Commands):\r