From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: bob.c.feng@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Mon, 22 Apr 2019 20:21:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Apr 2019 20:21:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,384,1549958400"; d="scan'208";a="137954948" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.47]) by orsmga006.jf.intel.com with ESMTP; 22 Apr 2019 20:21:39 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [Patch] BaseTools: Support customized compiling command Date: Tue, 23 Apr 2019 11:21:22 +0800 Message-Id: <20190423032122.29868-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1737 User may add other commands before CC command from build_rule.txt for specific purpose. It worked fine before commit 05217d210e. This patch is going to fix the bug in commit 05217d210e to support customized CC command. Signed-off-by: Bob Feng Cc: Liming Gao --- BaseTools/Source/Python/AutoGen/GenMake.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 7562dc68b3..0513807f4f 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1022,11 +1022,11 @@ cleanlib: 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]: + if len(SingleCommandList) > 0 and self.CheckCCCmd(SingleCommandList): for Temp in SingleCommandList: if Temp.startswith('/Fo'): CmdSign = '%s%s' % (Temp.rsplit(TAB_SLASH, 1)[0], TAB_SLASH) break else: continue @@ -1042,10 +1042,15 @@ cleanlib: T.Commands[Index] = '%s\n\t%s' % (' \\\n\t'.join(Cpplist), CmdTargetDict[CmdSign]) else: T.Commands.pop(Index) return T, CmdSumDict, CmdTargetDict, CmdCppDict + def CheckCCCmd(self, CommandList): + for cmd in CommandList: + if '$(CC)' in cmd: + return True + return False ## For creating makefile targets for dependent libraries def ProcessDependentLibrary(self): for LibraryAutoGen in self._AutoGenObject.LibraryAutoGenList: if not LibraryAutoGen.IsBinaryModule and not LibraryAutoGen.CanSkipbyHash(): self.LibraryBuildDirectoryList.append(self.PlaceMacro(LibraryAutoGen.BuildDir, self.Macros)) -- 2.20.1.windows.1