[edk2-devel] [Patch] BaseTools: Support customized compiling command

Bob Feng posted 1 patch 6 years, 9 months ago
Failed in applying to current master (apply log)
BaseTools/Source/Python/AutoGen/GenMake.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
[edk2-devel] [Patch] BaseTools: Support customized compiling command
Posted by Bob Feng 6 years, 9 months ago
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 <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39390): https://edk2.groups.io/g/devel/message/39390
Mute This Topic: https://groups.io/mt/31305514/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [Patch] BaseTools: Support customized compiling command
Posted by Liming Gao 6 years, 9 months ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Feng, Bob C
>Sent: Tuesday, April 23, 2019 11:21 AM
>To: devel@edk2.groups.io
>Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [Patch] BaseTools: Support customized compiling command
>
>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 <bob.c.feng@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> 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.BuildDi
>r, self.Macros))
>--
>2.20.1.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#39598): https://edk2.groups.io/g/devel/message/39598
Mute This Topic: https://groups.io/mt/31305514/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-