+ if Type in [TAB_OBJECT_FILE, TAB_STATIC_LIBRARY]:\r
+ Deps.append("$(%s)" % T.ListFileMacro)\r
+\r
+ if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT and Type == TAB_C_CODE_FILE:\r
+ T, CmdTarget, CmdTargetDict, CmdCppDict = self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict)\r
+ TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": CCodeDeps}\r
+ CmdLine = self._BUILD_TARGET_TEMPLATE.Replace(TargetDict).rstrip().replace('\t$(OBJLIST', '$(OBJLIST')\r
+ if T.Commands:\r
+ CmdLine = '%s%s' %(CmdLine, TAB_LINE_BREAK)\r
+ if CCodeDeps or CmdLine:\r
+ self.BuildTargetList.append(CmdLine)\r
+ else:\r
+ TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps}\r
+ self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict))\r
+\r
+ def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict):\r
+ if not CmdSumDict:\r
+ for item in self._AutoGenObject.Targets[Type]:\r
+ CmdSumDict[item.Target.SubDir] = item.Target.BaseName\r
+ for CppPath in item.Inputs:\r
+ Path = self.PlaceMacro(CppPath.Path, self.Macros)\r
+ if CmdCppDict.get(item.Target.SubDir):\r
+ CmdCppDict[item.Target.SubDir].append(Path)\r
+ else:\r
+ CmdCppDict[item.Target.SubDir] = ['$(MAKE_FILE)', Path]\r
+ if CppPath.Path in DependencyDict:\r
+ for Temp in DependencyDict[CppPath.Path]:\r
+ try:\r
+ Path = self.PlaceMacro(Temp.Path, self.Macros)\r
+ except:\r
+ continue\r
+ if Path not in (self.CommonFileDependency + CmdCppDict[item.Target.SubDir]):\r
+ CmdCppDict[item.Target.SubDir].append(Path)\r
+ if T.Commands:\r
+ CommandList = T.Commands[:]\r
+ for Item in CommandList[:]:\r
+ SingleCommandList = Item.split()\r
+ if len(SingleCommandList) > 0 and self.CheckCCCmd(SingleCommandList):\r
+ for Temp in SingleCommandList:\r
+ if Temp.startswith('/Fo'):\r
+ CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH)\r
+ break\r
+ else: continue\r
+ if CmdSign not in list(CmdTargetDict.keys()):\r
+ CmdTargetDict[CmdSign] = Item.replace(Temp, CmdSign)\r
+ else:\r
+ CmdTargetDict[CmdSign] = "%s %s" % (CmdTargetDict[CmdSign], SingleCommandList[-1])\r
+ Index = CommandList.index(Item)\r
+ CommandList.pop(Index)\r
+ if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, 1)[0]])):\r
+ Cpplist = CmdCppDict[T.Target.SubDir]\r
+ Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS)' % list(self.ObjTargetDict.keys()).index(T.Target.SubDir))\r
+ T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign])\r
+ else:\r
+ T.Commands.pop(Index)\r
+ return T, CmdSumDict, CmdTargetDict, CmdCppDict\r
+\r
+ def CheckCCCmd(self, CommandList):\r
+ for cmd in CommandList:\r
+ if '$(CC)' in cmd:\r
+ return True\r
+ return False\r