Zhiju: Why use /MP1? Can use /MP? Besides, if build_rule.txt is not updated to new one, build tool is updated. What will happen?
Thanks Liming > -----Original Message----- > From: Fan, ZhijuX > Sent: Wednesday, April 3, 2019 3:59 PM > To: edk2-de...@lists.01.org > Cc: Gao, Liming <liming....@intel.com>; Feng, Bob C <bob.c.f...@intel.com> > Subject: [edk2][PATCH V2] BaseTools:GenMakeFile Complete the task using CC > Tool multithreading > > CC_FLAGS "/Mp" enables multithreading with CC Tool. > In order to adapt to this change, I made some changes to other tools > > Cc: Bob Feng <bob.c.f...@intel.com> > Cc: Liming Gao <liming....@intel.com> > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Zhiju.Fan <zhijux....@intel.com> > --- > BaseTools/Conf/build_rule.template | 2 +- > BaseTools/Conf/tools_def.template | 48 ++++++++--------- > BaseTools/Source/Python/AutoGen/GenMake.py | 83 > +++++++++++++++++++++++++++--- > 3 files changed, 101 insertions(+), 32 deletions(-) > > diff --git a/BaseTools/Conf/build_rule.template > b/BaseTools/Conf/build_rule.template > index e56b1d9c59..4fc042f457 100755 > --- a/BaseTools/Conf/build_rule.template > +++ b/BaseTools/Conf/build_rule.template > @@ -129,7 +129,7 @@ > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj > > <Command.MSFT, Command.INTEL> > - "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} > + "$(CC)" /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src} > > <Command.GCC, Command.RVCT> > # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > index abda2164a6..f65df7dbd9 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -1810,9 +1810,9 @@ NOOPT_VS2012xASL_X64_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT:RE > *_VS2012x86_IA32_ASM_PATH = DEF(VS2012x86_BIN)\ml.exe > > *_VS2012x86_IA32_MAKE_FLAGS = /nologo > - DEBUG_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h > /EHs-c- /GR- /GF /Gy /Z7 > -RELEASE_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF > -NOOPT_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF > /Gy /Z7 /Od > + DEBUG_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h > /EHs-c- /GR- /GF /Gy /Z7 /MP1 > +RELEASE_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /MP1 > +NOOPT_VS2012x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF > /Gy /Z7 /Od /MP1 > > DEBUG_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi > RELEASE_VS2012x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd > @@ -1842,9 +1842,9 @@ NOOPT_VS2012x86_IA32_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT:REF > *_VS2012x86_X64_DLINK_PATH = DEF(VS2012x86_BINX64)\link.exe > *_VS2012x86_X64_ASLDLINK_PATH = DEF(VS2012x86_BINX64)\link.exe > > - DEBUG_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Z7 > -RELEASE_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF > -NOOPT_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 > /Od > + DEBUG_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- > /GR- /GF /Z7 /MP1 > +RELEASE_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /MP1 > +NOOPT_VS2012x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 > /Od /MP1 > > DEBUG_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi > RELEASE_VS2012x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd > @@ -2276,9 +2276,9 @@ NOOPT_VS2013xASL_X64_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT:RE > *_VS2013x86_IA32_ASM_PATH = DEF(VS2013x86_BIN)\ml.exe > > *_VS2013x86_IA32_MAKE_FLAGS = /nologo > - DEBUG_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h > /EHs-c- /GR- /GF /Gy /Z7 /Gw > -RELEASE_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gw > -NOOPT_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF > /Gy /Z7 /Od > + DEBUG_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h > /EHs-c- /GR- /GF /Gy /Z7 /Gw /MP1 > +RELEASE_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gw /MP1 > +NOOPT_VS2013x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF > /Gy /Z7 /Od /MP1 > > DEBUG_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi > RELEASE_VS2013x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd > @@ -2308,9 +2308,9 @@ NOOPT_VS2013x86_IA32_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT:REF > *_VS2013x86_X64_DLINK_PATH = DEF(VS2013x86_BINX64)\link.exe > *_VS2013x86_X64_ASLDLINK_PATH = DEF(VS2013x86_BINX64)\link.exe > > - DEBUG_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Z7 /Gw > -RELEASE_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Gw > -NOOPT_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 > /Od > + DEBUG_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- > /GR- /GF /Z7 /Gw /MP1 > +RELEASE_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Gw /MP1 > +NOOPT_VS2013x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 > /Od /MP1 > > DEBUG_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi > RELEASE_VS2013x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd > @@ -2746,9 +2746,9 @@ NOOPT_VS2015xASL_X64_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT:RE > *_VS2015x86_IA32_ASM_PATH = DEF(VS2015x86_BIN)\ml.exe > > *_VS2015x86_IA32_MAKE_FLAGS = /nologo > - DEBUG_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h > /EHs-c- /GR- /GF /Gy /Z7 /Gw > -RELEASE_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gw > -NOOPT_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF > /Gy /Z7 /Od > + DEBUG_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h > /EHs-c- /GR- /GF /Gy /Z7 /Gw /MP1 > +RELEASE_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gw /MP1 > +NOOPT_VS2015x86_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF > /Gy /Z7 /Od /MP1 > > DEBUG_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi > RELEASE_VS2015x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd > @@ -2778,9 +2778,9 @@ NOOPT_VS2015x86_IA32_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT:REF > *_VS2015x86_X64_DLINK_PATH = DEF(VS2015x86_BINX64)\link.exe > *_VS2015x86_X64_ASLDLINK_PATH = DEF(VS2015x86_BINX64)\link.exe > > - DEBUG_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Z7 /Gw > -RELEASE_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Gw > -NOOPT_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 > /Od > + DEBUG_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- > /GR- /GF /Z7 /Gw /MP1 > +RELEASE_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Gw /MP1 > +NOOPT_VS2015x86_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 > /Od /MP1 > > DEBUG_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi > RELEASE_VS2015x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd > @@ -2976,9 +2976,9 @@ NOOPT_VS2015x86xASL_X64_DLINK_FLAGS = /NOLOGO > /NODEFAULTLIB /IGNORE:4001 /OPT > *_VS2017_IA32_ASM_PATH = DEF(VS2017_BIN_IA32)\ml.exe > > *_VS2017_IA32_MAKE_FLAGS = /nologo > - DEBUG_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gy /Z7 /Gw > -RELEASE_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gw > -NOOPT_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy > /Z7 /Od > + DEBUG_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gy /Z7 /Gw /MP1 > +RELEASE_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /O1b2 /GL /FIAutoGen.h /EHs-c- > /GR- /GF /Gw /MP1 > +NOOPT_VS2017_IA32_CC_FLAGS = /nologo /arch:IA32 /c /WX /GS- /W4 > /Gs32768 /D UNICODE /FIAutoGen.h /EHs-c- /GR- /GF /Gy > /Z7 /Od /MP1 > > DEBUG_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi > RELEASE_VS2017_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd > @@ -3006,9 +3006,9 @@ NOOPT_VS2017_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB > /IGNORE:4001 /OPT:REF /O > *_VS2017_X64_DLINK_PATH = DEF(VS2017_BIN_X64)\link.exe > *_VS2017_X64_ASLDLINK_PATH = DEF(VS2017_BIN_X64)\link.exe > > - DEBUG_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Z7 /Gw > -RELEASE_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF > /Gw > -NOOPT_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od > + DEBUG_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- > /GF /Z7 /Gw /MP1 > +RELEASE_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF > /Gw /MP1 > +NOOPT_VS2017_X64_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs32768 /D > UNICODE /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Z7 /Od > /MP1 > > DEBUG_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi > RELEASE_VS2017_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd > diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py > b/BaseTools/Source/Python/AutoGen/GenMake.py > index b441817b52..10db56dbc4 100644 > --- a/BaseTools/Source/Python/AutoGen/GenMake.py > +++ b/BaseTools/Source/Python/AutoGen/GenMake.py > @@ -19,6 +19,7 @@ import sys > import string > import re > import os.path as path > +import multiprocessing > from Common.LongFilePathSupport import OpenLongFilePath as open > from Common.MultipleWorkspace import MultipleWorkspace as mws > from Common.BuildToolError import * > @@ -435,7 +436,7 @@ cleanlib: > self.CommonFileDependency = [] > self.FileListMacros = {} > self.ListFileMacros = {} > - > + self.ObjTargetDict = {} > self.FileCache = {} > self.LibraryBuildCommandList = [] > self.LibraryFileList = [] > @@ -518,6 +519,10 @@ cleanlib: > # Remove duplicated include path, if any > if Attr == "FLAGS": > Value = RemoveDupOption(Value, IncPrefix, > MyAgo.IncludePathList) > + if self._AutoGenObject.BuildRuleFamily == > TAB_COMPILER_MSFT and Tool == 'CC': > + ThreadNumber = GlobalData.gOptions.ThreadNumber > if GlobalData.gOptions.ThreadNumber else > multiprocessing.cpu_count() > + Value = Value.replace('/MP1', '%s%d' % ('/MP', > ThreadNumber)).replace(' /GM', '') > + MyAgo.BuildOption[Tool][Attr] = Value > if Tool == "OPTROM" and PCI_COMPRESS_Flag: > ValueList = Value.split() > if ValueList: > @@ -618,6 +623,11 @@ cleanlib: > False > ) > > + # Generate objlist used to create .obj file > + for Type in self.ObjTargetDict: > + NewLine = ' '.join(list(self.ObjTargetDict[Type])) > + FileMacroList.append("OBJLIST_%s = %s" % > (list(self.ObjTargetDict.keys()).index(Type), NewLine)) > + > BcTargetList = [] > > MakefileName = self._FILE_NAME_[self._FileType] > @@ -927,6 +937,10 @@ cleanlib: > for File in DepSet: > self.CommonFileDependency.append(self.PlaceMacro(File.Path, > self.Macros)) > > + CmdSumDict = {} > + CmdTargetDict = {} > + CmdCppDict = {} > + DependencyDict = FileDependencyDict.copy() > for File in FileDependencyDict: > # skip non-C files > if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c": > @@ -934,6 +948,7 @@ cleanlib: > NewDepSet = set(FileDependencyDict[File]) > NewDepSet -= DepSet > FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet) > + DependencyDict[File] = list(NewDepSet) > > # Convert target description object to target string in makefile > for Type in self._AutoGenObject.Targets: > @@ -945,11 +960,21 @@ cleanlib: > self.ListFileMacros[T.ListFileMacro] = [] > if T.GenIncListFile and T.IncListFileMacro not in > self.ListFileMacros: > self.ListFileMacros[T.IncListFileMacro] = [] > + if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT > and Type == TAB_C_CODE_FILE: > + NewFile = self.PlaceMacro(str(T), self.Macros) > + if self.ObjTargetDict.get(T.Target.SubDir): > + self.ObjTargetDict[T.Target.SubDir].add(NewFile) > + else: > + self.ObjTargetDict[T.Target.SubDir] = set() > + self.ObjTargetDict[T.Target.SubDir].add(NewFile) > > Deps = [] > + CCodeDeps = [] > # Add force-dependencies > for Dep in T.Dependencies: > Deps.append(self.PlaceMacro(str(Dep), self.Macros)) > + if Dep != '$(MAKE_FILE)': > + CCodeDeps.append(self.PlaceMacro(str(Dep), > self.Macros)) > # Add inclusion-dependencies > if len(T.Inputs) == 1 and T.Inputs[0] in FileDependencyDict: > for F in FileDependencyDict[T.Inputs[0]]: > @@ -973,12 +998,56 @@ cleanlib: > if Type in [TAB_OBJECT_FILE, TAB_STATIC_LIBRARY]: > Deps.append("$(%s)" % T.ListFileMacro) > > - TargetDict = { > - "target" : self.PlaceMacro(T.Target.Path, > self.Macros), > - "cmd" : "\n\t".join(T.Commands), > - "deps" : Deps > - } > - > self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict)) > + if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT > and Type == TAB_C_CODE_FILE: > + T, CmdTarget, CmdTargetDict, CmdCppDict = > self.ParserCCodeFile(T, Type, CmdSumDict, CmdTargetDict, > CmdCppDict, DependencyDict) > + TargetDict = {"target": self.PlaceMacro(T.Target.Path, > self.Macros), "cmd": "\n\t".join(T.Commands),"deps": > CCodeDeps} > + CmdLine = > self._BUILD_TARGET_TEMPLATE.Replace(TargetDict).rstrip().replace('\t$(OBJLIST', > '$(OBJLIST') > + if T.Commands: > + CmdLine = '%s%s' %(CmdLine, TAB_LINE_BREAK) > + if CCodeDeps or CmdLine: > + self.BuildTargetList.append(CmdLine) > + else: > + TargetDict = {"target": self.PlaceMacro(T.Target.Path, > self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps} > + > self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict)) > + > + def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, > CmdCppDict, DependencyDict): > + if not CmdSumDict: > + for item in self._AutoGenObject.Targets[Type]: > + CmdSumDict[item.Target.SubDir] = item.Target.BaseName > + for CppPath in item.Inputs: > + Path = self.PlaceMacro(CppPath.Path, self.Macros) > + if CmdCppDict.get(item.Target.SubDir): > + CmdCppDict[item.Target.SubDir].append(Path) > + else: > + CmdCppDict[item.Target.SubDir] = ['$(MAKE_FILE)', > Path] > + if CppPath.Path in DependencyDict: > + for Temp in DependencyDict[CppPath.Path]: > + Path = self.PlaceMacro(Temp.Path, self.Macros) > + if Path not in (self.CommonFileDependency + > CmdCppDict[item.Target.SubDir]): > + CmdCppDict[item.Target.SubDir].append(Path) > + if T.Commands: > + CommandList = T.Commands[:] > + for Item in CommandList[:]: > + SingleCommandList = Item.split() > + if len(SingleCommandList) > 0 and '$(CC)' in > SingleCommandList[0]: > + for Temp in SingleCommandList: > + if Temp.startswith('/Fo'): > + CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, > 1)[0], TAB_SLASH) > + break > + else: continue > + if CmdSign not in list(CmdTargetDict.keys()): > + CmdTargetDict[CmdSign] = Item.replace(Temp, CmdSign) > + else: > + CmdTargetDict[CmdSign] = "%s %s" % > (CmdTargetDict[CmdSign], SingleCommandList[-1]) > + Index = CommandList.index(Item) > + CommandList.pop(Index) > + if SingleCommandList[-1].endswith("%s%s.c" % (TAB_SLASH, > CmdSumDict[CmdSign.lstrip('/Fo').rsplit(TAB_SLASH, > 1)[0]])): > + Cpplist = CmdCppDict[T.Target.SubDir] > + Cpplist.insert(0, '$(OBJLIST_%d): $(COMMON_DEPS)' % > list(self.ObjTargetDict.keys()).index(T.Target.SubDir)) > + T.Commands[Index] = '%s\n\t%s' % (' > \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign]) > + else: > + T.Commands.pop(Index) > + return T, CmdSumDict, CmdTargetDict, CmdCppDict > > ## For creating makefile targets for dependent libraries > def ProcessDependentLibrary(self): > -- > 2.14.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#38668): https://edk2.groups.io/g/devel/message/38668 Mute This Topic: https://groups.io/mt/30972425/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-