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.web11.213.1618004928379640127 for ; Fri, 09 Apr 2021 14:48:48 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: michael.d.kinney@intel.com) IronPort-SDR: QfpDWLGqKI4xwQ/N8G7uKQ2hI9YR2MCwtWyMJ1HPi2pjG9ycGPFlguhoYbHChCSZg6ypLWnBFV r73hDj54WtvQ== X-IronPort-AV: E=McAfee;i="6000,8403,9949"; a="214283122" X-IronPort-AV: E=Sophos;i="5.82,210,1613462400"; d="scan'208";a="214283122" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2021 14:48:47 -0700 IronPort-SDR: FMhrsWTmlRCFqQsEnoFEmr7wn+eiXGwhjA2xkBDtCtqWTJNUuslbK7rX0Q2szZoRENWg6bLalg cdHIK0IrVZfA== X-IronPort-AV: E=Sophos;i="5.82,210,1613462400"; d="scan'208";a="599287375" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.212.230.114]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Apr 2021 14:48:44 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen Subject: [Patch 1/1] BaseTools/PlatformAutoGen: MAKE_FLAGS and MAKE_PATH fixes Date: Fri, 9 Apr 2021 14:48:38 -0700 Message-Id: <20210409214838.1501-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3312 Update parsing of MAKE_FLAGS in DSC [BuildOptions] sections to split the flags into a list to be compatible with running the make command using Popen(). Parsing MAKE_FLAGS from tools_def.txt already uses _SplitOption(). This change uses the same _SplitOption() method for MAKE_FLAGS from a DSC [BuildOptions] section. Also update the parsing of MAKE_PATH to support MAKE_PATH from tools_def.txt or the DSC [BuildOptions] section. MAKE_PATH in DSC [BuildOptions] section is higher priority than MAKE_PATH in tools_def.txt. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Michael D Kinney --- .../Source/Python/AutoGen/PlatformAutoGen.py | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py index 7d8e7b3c7cc1..c16f2e4cd8b7 100644 --- a/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/PlatformAutoGen.py @@ -1,7 +1,7 @@ ## @file # Create makefile for MS nmake and GNU make # -# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.
# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -805,20 +805,26 @@ class PlatformAutoGen(AutoGen): # @cached_property def BuildCommand(self): - RetVal = [] - if "MAKE" in self.ToolDefinition and "PATH" in self.ToolDefinition["MAKE"]: - RetVal += _SplitOption(self.ToolDefinition["MAKE"]["PATH"]) - if "FLAGS" in self.ToolDefinition["MAKE"]: - NewOption = self.ToolDefinition["MAKE"]["FLAGS"].strip() - if NewOption != '': - RetVal += _SplitOption(NewOption) - if "MAKE" in self.EdkIIBuildOption: - if "FLAGS" in self.EdkIIBuildOption["MAKE"]: - Flags = self.EdkIIBuildOption["MAKE"]["FLAGS"] - if Flags.startswith('='): - RetVal = [RetVal[0]] + [Flags[1:]] - else: - RetVal.append(Flags) + if "MAKE" in self.EdkIIBuildOption and "PATH" in self.EdkIIBuildOption["MAKE"]: + # MAKE_PATH in DSC [BuildOptions] section is higher priority + Path = self.EdkIIBuildOption["MAKE"]["PATH"] + if Path.startswith('='): + Path = Path[1:].strip() + RetVal = _SplitOption(Path) + elif "MAKE" in self.ToolDefinition and "PATH" in self.ToolDefinition["MAKE"]: + RetVal = _SplitOption(self.ToolDefinition["MAKE"]["PATH"]) + else: + return [] + if "MAKE" in self.ToolDefinition and "FLAGS" in self.ToolDefinition["MAKE"]: + NewOption = self.ToolDefinition["MAKE"]["FLAGS"].strip() + if NewOption != '': + RetVal += _SplitOption(NewOption) + if "MAKE" in self.EdkIIBuildOption and "FLAGS" in self.EdkIIBuildOption["MAKE"]: + Flags = self.EdkIIBuildOption["MAKE"]["FLAGS"] + if Flags.startswith('='): + RetVal = [RetVal[0]] + _SplitOption(Flags[1:].strip()) + else: + RetVal = RetVal + _SplitOption(Flags.strip()) return RetVal ## Get tool chain definition -- 2.31.1.windows.1