Reviewed-by: Bob Feng <bob.c.f...@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Bob Feng
Sent: Wednesday, September 23, 2020 6:58 PM
To: devel@edk2.groups.io
Cc: Liang, MingyueX <mingyuex.li...@intel.com>; Liming Gao 
<gaolim...@byosoft.com.cn>; Chen, Christine <yuwei.c...@intel.com>
Subject: [edk2-devel] [PATCH] BaseTools: Normalize case of pathname when 
evaluating Macros.

From: Mingyue Liang <mingyuex.li...@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2880

Currently, When doing the Incremental build, the directory macros extended to 
absolute path in output Makefile, which is inconsistent with the output of 
Clean build.

When we do macro replacement, we can't replace macro due to inconsistent path 
case, which results in inconsistent display of incremental build and clean 
build in makefile.Therefore, the path is converted to achieve the correct macro 
replacement.

Signed-off-by: Mingyue Liang <mingyuex.li...@intel.com>
Cc: Bob Feng <bob.c.f...@intel.com>
Cc: Liming Gao <gaolim...@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.c...@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenMake.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index 0314d0ea34..b04d3f5436 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -786,8 +786,10 @@ cleanlib:
 
     def ReplaceMacro(self, str):
         for Macro in self.MacroList:
-            if self._AutoGenObject.Macros[Macro] and 
self._AutoGenObject.Macros[Macro] in str:
-                str = str.replace(self._AutoGenObject.Macros[Macro], '$(' + 
Macro + ')')
+            if self._AutoGenObject.Macros[Macro] and 
os.path.normcase(self._AutoGenObject.Macros[Macro]) in os.path.normcase(str):
+                replace_dir = 
str[os.path.normcase(str).index(os.path.normcase(self._AutoGenObject.Macros[Macro])):
 os.path.normcase(str).index(
+                    os.path.normcase(self._AutoGenObject.Macros[Macro])) + 
len(self._AutoGenObject.Macros[Macro])]
+                str = str.replace(replace_dir, '$(' + Macro + ')')
         return str
 
     def CommandExceedLimit(self):
--
2.28.0.windows.1








-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#65555): https://edk2.groups.io/g/devel/message/65555
Mute This Topic: https://groups.io/mt/77032381/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to