From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web10.10660.1600858674626219321 for ; Wed, 23 Sep 2020 03:57:54 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: bob.c.feng@intel.com) IronPort-SDR: 0Bc2lbkuA8FlQYu2fM70jB8I2HmzOxifBLbztH8IWkj42KhF/F221RIGHIZQPknfF/f1zpBzPT sN1B5N5KmueQ== X-IronPort-AV: E=McAfee;i="6000,8403,9752"; a="178928348" X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="178928348" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2020 03:57:53 -0700 IronPort-SDR: Af621OrRbkYQcBqjyp+C/kkKMF+uXEGXTSud/x11r0hMeq2/pzGpAwhv4pTaabazuS9GiviL0F hgS+Kgv0N0ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,293,1596524400"; d="scan'208";a="347309995" Received: from shwdepsi1121.ccr.corp.intel.com ([10.239.158.66]) by FMSMGA003.fm.intel.com with ESMTP; 23 Sep 2020 03:57:52 -0700 From: "Bob Feng" To: devel@edk2.groups.io Cc: Mingyue Liang , Liming Gao , Yuwei Chen Subject: [PATCH] BaseTools: Normalize case of pathname when evaluating Macros. Date: Wed, 23 Sep 2020 18:57:32 +0800 Message-Id: <20200923105732.34648-1-bob.c.feng@intel.com> X-Mailer: git-send-email 2.20.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Mingyue Liang 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 Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen --- 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