From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web09.6313.1580904076595253378 for ; Wed, 05 Feb 2020 04:01:16 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: bob.c.feng@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2020 04:01:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,405,1574150400"; d="scan'208";a="254741245" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 05 Feb 2020 04:01:15 -0800 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 5 Feb 2020 04:01:15 -0800 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 5 Feb 2020 20:01:11 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Wed, 5 Feb 2020 20:01:11 +0800 From: "Bob Feng" To: Pierre Gondois , "devel@edk2.groups.io" CC: "Gao, Liming" , Sami Mujawar , nd Subject: Re: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile generation Thread-Topic: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile generation Thread-Index: AQHV21LZi9RY4K8dtU+n9F6oo250ZqgK7xJwgAGPl2A= Date: Wed, 5 Feb 2020 12:01:11 +0000 Message-ID: <874f633277b04793b6d9e2be12529469@intel.com> References: <15F0315032D95F8E.2867@groups.io> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZjgxNTRlNWEtNjZmNi00YjcwLTgyZTAtNTYxYzdmYjUzZDY2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYTBFeCsrU0FHUWlNTEVDYlpTeFwvNTJ0c2lBVGZwb2d5cXVlOER2TXpMOE8xZVl4eUNCWUF5bnZ3cm00NkZoWncifQ== dlp-version: 11.2.0.6 dlp-product: dlpe-windows x-ctpclassification: CTP_NT dlp-reaction: no-action x-originating-ip: [10.239.127.36] MIME-Version: 1.0 Return-Path: bob.c.feng@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Pierre, I agree with this change. But for this patch, I found there are two bugs. 1.=20 + # Get Makefile name. + def getMakefileName(self): + if not self._FileType: + return _DEFAULT_FILE_NAME_ =20 Should be self. _DEFAULT_FILE_NAME_ =20 + else: + return self._FILE_NAME_[self._FileType] + 2. - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile.getMakefileName())): return None for m_build_dir in ModuleBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile.getMakefileName())): return None getMakefileName() can't be called from its class.=20 This bug can be triggered by=20 build genmake -p OvmfPkg\OvmfPkgIa32.dsc -a IA32 -t VS2015x86 build -u -p OvmfPkg\OvmfPkgIa32.dsc -a IA32 -t VS2015x86 The second build will fail. Thanks, Bob -----Original Message----- From: Pierre Gondois =20 Sent: Tuesday, February 4, 2020 8:03 PM To: devel@edk2.groups.io; Pierre Gondois Cc: Feng, Bob C ; Gao, Liming = ; Sami Mujawar ; nd Subject: RE: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile g= eneration Hello Liming and Bob, To answer Liming's questions, I am building the DynamicTablesPkg with the = patch with the AARCH64-DEBUG and the following configurations: Windows - GCC - GNUmake Windows - GCC - nmake Windows - VS2017 - GNUmake Windows - VS2017 - nmake Linux - GCC5 - GNUmake For the record, when building with the Windows-VS2017-GNUmake configuratio= n, the *_*_*_MAKE_FLAG(S) variable is set to "/nologo". As this is a nmake = specific flag, it has to be removed when using GNUmake. Some warning flags = also need to be slightly modified when building with VS2017. To modify the type of make tool to use (GNUmake or nmake), I modify the fo= llowing variable in Conf/tools_def.txt: *_[GCC5|VS2017]_*_MAKE_PATH =3D [nmake|GNUmake] I am building the ShellPkg with the patch and a small modification on how = nasm files are added for IA32 and X64 for the following configurations: Windows - VS2017 - GNUmake Windows - VS2017 - nmake Linux - GCC - GNUmake Unfortunately, the gcc compiler available on windows doesn't provide all t= he options of the one available on linux. For instances: * When building ShellPkg-DEBUG build-X64 -Windows-GCC-[nmake], the "-mcmo= del=3Dsmall" option provided is not supported. * When building ShellPkg-DEBUG build-IA32-Windows-GCC-[nmake], the "-m,el= f_i386" option provided is not supported. These issues are related to the compiler and not to the patch. The Windows-GCC-GNUmake configuration is very important for Arm. This conf= iguration was working fine until patch "0c3e8e9947a6c13b4327dd11b20acb95441= 701cf BaseTools: Enhance Basetool for incremental build" was merged in edk2= . Regards, Pierre -----Original Message----- From: devel@edk2.groups.io On Behalf Of PierreGondo= is via Groups.Io Sent: 04 February 2020 12:01 To: devel@edk2.groups.io Cc: Pierre Gondois ; bob.c.feng@intel.com; liming.= gao@intel.com; Sami Mujawar ; Pierre Gondois ; nd Subject: [edk2-devel] [PATCH v2 1/1] BaseTools: Rationalise makefile gener= ation From: Pierre Gondois The GenMake.py script tests the platform environment to determine the type= of makefile that needs to be generated. If a Windows build host is detecte= d, the makefile generated is of Nmake type. Otherwise a GNUmake type is gen= erated. Furthermore, the ___MAKE_PATH option in tools_def.template defines the make tool to use. E.g.: for VS2017 this is configured to use Nmake, cf. *_VS2017_*_MAKE_PATH =3D DEF(VS2017_BIN_HOST)\nmake.exe while for GCC5 it = is setup to use GNU make. *_GCC5_*_MAKE_PATH =3D DEF(GCC_HOST_PREFIX)make This prevents using the GCC compiler toolchain on a Windows build host. To address this issue this patch introduces 2 factors to determine the gen= erated makefile output. 1. Platform -> to determine shell commands used in makefile. 2. MakeTool -> to determine the type of makefile that needs to be generated. Signed-off-by: Pierre Gondois Signed-off-by: Sami Mujawar --- The changes can be seen at https://github.com/PierreARM/edk2/tree/720_Base= Tools_Rationalise_makefile_generation_v2 Notes: v2: - Rebase on latest master [Pierre] BaseTools/Source/Python/AutoGen/GenMake.py | 122 ++++++++++------= ---- BaseTools/Source/Python/AutoGen/IncludesAutoGen.py | 34 +++--- BaseTools/Source/Python/build/build.py | 7 +- 3 files changed, 88 insertions(+), 75 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source= /Python/AutoGen/GenMake.py index ba199c1aa73dc46856b41c13e07e3d9770081acd..f49c765c791d57c06fcccf7059= b37a018dc68ae6 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -2,6 +2,7 @@ # Create makefile for MS nmake and GNU make # # Copyright (c) 2007 - 20= 20, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # =20 @@ -52,13 +53,6 @@ gIncludeMacroConversion =3D { "EFI_PPI_DEPENDENCY" : gPpiDefinition, } =20 -## default makefile type -gMakeType =3D "" -if sys.platform =3D=3D "win32": - gMakeType =3D "nmake" -else: - gMakeType =3D "gmake" - =20 ## BuildFile class # @@ -77,6 +71,13 @@ class BuildFile(object): "gmake" : "GNUmakefile" } =20 + # Get Makefile name. + def getMakefileName(self): + if not self._FileType: + return _DEFAULT_FILE_NAME_ + else: + return self._FILE_NAME_[self._FileType] + ## Fixed header string for makefile _MAKEFILE_HEADER =3D '''# # DO NOT EDIT @@ -106,7 +107,7 @@ class BuildFile(object): # $(RD) remove dir command # _SHELL_CMD_ =3D { - "nmake" : { + "win32" : { "CP" : "copy /y", "MV" : "move /y", "RM" : "del /f /q", @@ -114,7 +115,7 @@ class BuildFile(object): "RD" : "rmdir /s /q", }, =20 - "gmake" : { + "posix" : { "CP" : "cp -f", "MV" : "mv -f", "RM" : "rm -f", @@ -125,35 +126,35 @@ class BuildFile(object): =20 ## directory separator _SEP_ =3D { - "nmake" : "\\", - "gmake" : "/" + "win32" : "\\", + "posix" : "/" } =20 ## directory creation template _MD_TEMPLATE_ =3D { - "nmake" : 'if not exist %(dir)s $(MD) %(dir)s', - "gmake" : "$(MD) %(dir)s" + "win32" : 'if not exist %(dir)s $(MD) %(dir)s', + "posix" : "$(MD) %(dir)s" } =20 ## directory removal template _RD_TEMPLATE_ =3D { - "nmake" : 'if exist %(dir)s $(RD) %(dir)s', - "gmake" : "$(RD) %(dir)s" + "win32" : 'if exist %(dir)s $(RD) %(dir)s', + "posix" : "$(RD) %(dir)s" } ## cp if exist _CP_TEMPLATE_ =3D { - "nmake" : 'if exist %(Src)s $(CP) %(Src)s %(Dst)s', - "gmake" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s" + "win32" : 'if exist %(Src)s $(CP) %(Src)s %(Dst)s', + "posix" : "test -f %(Src)s && $(CP) %(Src)s %(Dst)s" } =20 _CD_TEMPLATE_ =3D { - "nmake" : 'if exist %(dir)s cd %(dir)s', - "gmake" : "test -e %(dir)s && cd %(dir)s" + "win32" : 'if exist %(dir)s cd %(dir)s', + "posix" : "test -e %(dir)s && cd %(dir)s" } =20 _MAKE_TEMPLATE_ =3D { - "nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)= s', - "gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(fil= e)s' + "win32" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)= s', + "posix" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(fil= e)s' } =20 _INCLUDE_CMD_ =3D { @@ -169,22 +170,30 @@ class BuildFile(object): # def __init__(self, AutoGenObject): self._AutoGenObject =3D AutoGenObject - self._FileType =3D gMakeType =20 - ## Create build file + MakePath =3D AutoGenObject.BuildOption.get('MAKE', {}).get('PATH'= ) + if not MakePath: + self._FileType =3D "" + elif "nmake" in MakePath: + self._FileType =3D "nmake" + else: + self._FileType =3D "gmake" + + if sys.platform =3D=3D "win32": + self._Platform =3D "win32" + else: + self._Platform =3D "posix" + + ## Create build file. # - # @param FileType Type of build file. Only nmake and gmake are = supported now. + # Only nmake and gmake are supported. # - # @retval TRUE The build file is created or re-created succe= ssfully - # @retval FALSE The build file exists and is the same as the = one to be generated + # @retval TRUE The build file is created or re-created succes= sfully + # @retval FALSE The build file exists and is the same as the o= ne to be generated # - def Generate(self, FileType=3DgMakeType): - if FileType not in self._FILE_NAME_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid build ty= pe [%s]" % FileType, - ExtraData=3D"[%s]" % str(self._AutoGenObject)= ) - self._FileType =3D FileType + def Generate(self): FileContent =3D self._TEMPLATE_.Replace(self._TemplateDict) - FileName =3D self._FILE_NAME_[FileType] + FileName =3D self.getMakefileName() if not os.path.exists(os.path.join(self._AutoGenObject.MakeFileDi= r, "deps.txt")): with open(os.path.join(self._AutoGenObject.MakeFileDir, "deps= .txt"),"w+") as fd: fd.write("") @@ -203,7 +212,7 @@ class BuildFile(object): # @retval list The directory creation command list # def GetCreateDirectoryCommand(self, DirList): - return [self._MD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir = in DirList] + return [self._MD_TEMPLATE_[self._Platform] % {'dir':Dir} for=20 + Dir in DirList] =20 ## Return a list of directory removal command string # @@ -212,7 +221,7 @@ class BuildFile(object): # @retval list The directory removal command list # def GetRemoveDirectoryCommand(self, DirList): - return [self._RD_TEMPLATE_[self._FileType] % {'dir':Dir} for Dir = in DirList] + return [self._RD_TEMPLATE_[self._Platform] % {'dir':Dir} for=20 + Dir in DirList] =20 def PlaceMacro(self, Path, MacroDefinitions=3DNone): if Path.startswith("$("): @@ -462,11 +471,8 @@ cleanlib: # Compose a dict object containing information used to do replacement= in template @property def _TemplateDict(self): - if self._FileType not in self._SEP_: - EdkLogger.error("build", PARAMETER_INVALID, "Invalid Makefile= type [%s]" % self._FileType, - ExtraData=3D"[%s]" % str(self._AutoGenObject)= ) MyAgo =3D self._AutoGenObject - Separator =3D self._SEP_[self._FileType] + Separator =3D self._SEP_[self._Platform] =20 # break build if no source files and binary files are found if len(MyAgo.SourceFileList) =3D=3D 0 and len(MyAgo.BinaryFileLis= t) =3D=3D 0: @@ -628,10 +634,10 @@ cleanlib: =20 BcTargetList =3D [] =20 - MakefileName =3D self._FILE_NAME_[self._FileType] + MakefileName =3D self.getMakefileName() LibraryMakeCommandList =3D [] for D in self.LibraryBuildDirectoryList: - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":os= .path.join(D, MakefileName)} + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 + {"file":os.path.join(D, MakefileName)} LibraryMakeCommandList.append(Command) =20 package_rel_dir =3D MyAgo.SourceDir @@ -683,8 +689,8 @@ cleanlib: "separator" : Separator, "module_tool_definitions" : ToolsDef, =20 - "shell_command_code" : list(self._SHELL_CMD_[self._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].values()), =20 "module_entry_point" : ModuleEntryPoint, "image_entry_point" : ImageEntryPoint, @@ -721,7 +727,7 @@ cleanlib: self.ResultFileList.append(Dst) if '%s :' %(Dst) not in self.BuildTargetList: self.BuildTargetList.append("%s :" %(Dst)) - self.BuildTargetList.append('\t' + self._CP_TEMPL= ATE_[self._FileType] %{'Src': Src, 'Dst': Dst}) + self.BuildTargetList.append('\t' +=20 + self._CP_TEMPLATE_[self._Platform] %{'Src': Src, 'Dst': Dst}) =20 FfsCmdList =3D Cmd[0] for index, Str in enumerate(FfsCmdList): @@ -1222,7 +1228,7 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ # Compose a dict object containing information used to do replacement= in template @property def _TemplateDict(self): - Separator =3D self._SEP_[self._FileType] + Separator =3D self._SEP_[self._Platform] MyAgo =3D self._AutoGenObject if self._FileType not in MyAgo.CustomMakefile: EdkLogger.error('build', OPTION_NOT_SUPPORTED, "No custom mak= efile for %s" % self._FileType, @@ -1252,7 +1258,7 @@ ${BEGIN}\t-@${create_= directory_command}\n${END}\ ToolsDef.append("%s_%s =3D %s" % (Tool, Attr, MyAgo.B= uildOption[Tool][Attr])) ToolsDef.append("") =20 - MakefileName =3D self._FILE_NAME_[self._FileType] + MakefileName =3D self.getMakefileName() MakefileTemplateDict =3D { "makefile_header" : self._FILE_HEADER_[self._FileTy= pe], "makefile_path" : os.path.join("$(MODULE_BUILD_DI= R)", MakefileName), @@ -1285,8 +1291,8 @@ ${BEGIN}\t-@${create_directory_command}\n${END}\ "separator" : Separator, "module_tool_definitions" : ToolsDef, =20 - "shell_command_code" : list(self._SHELL_CMD_[self._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].values()), =20 "create_directory_command" : self.GetCreateDirectoryCommand(= self.IntermediateDirectoryList), "custom_makefile_content" : CustomMakefile @@ -1413,7 +1419,7 @@ cleanlib: # Compose a dict object containing information used to do replacement= in template @property def _TemplateDict(self): - Separator =3D self._SEP_[self._FileType] + Separator =3D self._SEP_[self._Platform] =20 MyAgo =3D self._AutoGenObject if "MAKE" not in MyAgo.ToolDefinition or "PATH" not in MyAgo.Tool= Definition["MAKE"]: @@ -1424,13 +1430,13 @@ cleanlib: self.ModuleBuildDirectoryList =3D self.GetModuleBuildDirectoryLis= t() self.LibraryBuildDirectoryList =3D self.GetLibraryBuildDirectoryL= ist() =20 - MakefileName =3D self._FILE_NAME_[self._FileType] + MakefileName =3D self.getMakefileName() LibraryMakefileList =3D [] LibraryMakeCommandList =3D [] for D in self.LibraryBuildDirectoryList: D =3D self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir}) Makefile =3D os.path.join(D, MakefileName) - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":Ma= kefile} + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 + {"file":Makefile} LibraryMakefileList.append(Makefile) LibraryMakeCommandList.append(Command) self.LibraryMakeCommandList =3D LibraryMakeCommandList @@ -1440,7= +1446,7 @@ cleanlib: for D in self.ModuleBuildDirectoryList: D =3D self.PlaceMacro(D, {"BUILD_DIR":MyAgo.BuildDir}) Makefile =3D os.path.join(D, MakefileName) - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":Ma= kefile} + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 + {"file":Makefile} ModuleMakefileList.append(Makefile) ModuleMakeCommandList.append(Command) =20 @@ -1460,8 +1466,8 @@ cleanlib: =20 "toolchain_tag" : MyAgo.ToolChain, "build_target" : MyAgo.BuildTarget, - "shell_command_code" : list(self._SHELL_CMD_[self._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].values()), "build_architecture_list" : MyAgo.Arch, "architecture" : MyAgo.Arch, "separator" : Separator, @@ -1519,7 +1525,7 @@ class TopLevelMakefile(BuildFile): # Compose a dict object containing information used to do replacement= in template @property def _TemplateDict(self): - Separator =3D self._SEP_[self._FileType] + Separator =3D self._SEP_[self._Platform] =20 # any platform autogen object is ok because we just need common i= nformation MyAgo =3D self._AutoGenObject @@ -1575,10 +1581,10 @@ class TopLevelMakefile(BuildFile): else: ExtraOption +=3D " --pcd " + pcdname + '=3D' + pcd[3] =20 - MakefileName =3D self._FILE_NAME_[self._FileType] + MakefileName =3D self.getMakefileName() SubBuildCommandList =3D [] for A in MyAgo.ArchList: - Command =3D self._MAKE_TEMPLATE_[self._FileType] % {"file":os= .path.join("$(BUILD_DIR)", A, MakefileName)} + Command =3D self._MAKE_TEMPLATE_[self._Platform] %=20 + {"file":os.path.join("$(BUILD_DIR)", A, MakefileName)} SubBuildCommandList.append(Command) =20 MakefileTemplateDict =3D { @@ -1593,8 +1599,8 @@ class TopLevelMakefile(BuildFile): =20 "toolchain_tag" : MyAgo.ToolChain, "build_target" : MyAgo.BuildTarget, - "shell_command_code" : list(self._SHELL_CMD_[self._Fil= eType].keys()), - "shell_command" : list(self._SHELL_CMD_[self._Fil= eType].values()), + "shell_command_code" : list(self._SHELL_CMD_[self._Pla= tform].keys()), + "shell_command" : list(self._SHELL_CMD_[self._Pla= tform].values()), 'arch' : list(MyAgo.ArchList), "build_architecture_list" : ','.join(MyAgo.ArchList), "separator" : Separator, diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTool= s/Source/Python/AutoGen/IncludesAutoGen.py index 1ca1798907ef9b46a17d8938bb2f673d5ade662f..ca9e02d19b4afad82241abb8e1= 5845731cabd22f 100644 --- a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py +++ b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py @@ -2,6 +2,7 @@ # Build cache intermediate result and state # # Copyright (c) 2019 - 20= 20, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # from Common.caching im= port cached_property @@ -12,20 +13,6 @@ from Common.Misc import SaveFileOnC= hange, PathClass from Common.Misc import TemplateString import sys gIsFi= leMap =3D {} -if sys.platform =3D=3D "win32": - _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' -${BEGIN} -!IF EXIST(${deps_file}) -!INCLUDE ${deps_file} -!ENDIF -${END} - ''') -else: - _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' -${BEGIN} --include ${deps_file} -${END} - ''') =20 DEP_FILE_TAIL =3D "# Updated \n" =20 @@ -59,6 +46,25 @@ class IncludesAutoGen(): =20 def CreateDepsInclude(self): deps_file =3D {'deps_file':self.deps_files} + + MakePath =3D self.module_autogen.BuildOption.get('MAKE', {}).get(= 'PATH') + if not MakePath: + EdkLogger.error("build", PARAMETER_MISSING, Message=3D"No Mak= e path available.") + elif "nmake" in MakePath: + _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' + ${BEGIN} + !IF EXIST(${deps_file}) + !INCLUDE ${deps_file} + !ENDIF + ${END} + ''') + else: + _INCLUDE_DEPS_TEMPLATE =3D TemplateString(''' + ${BEGIN} + -include ${deps_file} + ${END} + ''') + try: deps_include_str =3D _INCLUDE_DEPS_TEMPLATE.Replace(deps_file= ) except Exception as e: diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyt= hon/build/build.py index 1e47e382cba94dc6fba7d8ecad2bc924b02cea1d..8e6625ae42afe5ed5fddbdb72e= f5e8ca044609b4 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -4,6 +4,7 @@ # Copyright (c) 2014, Hewlett-Packard Development Company, L.P.
# = Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.
# = Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
+# Copyright (c) 2020, ARM Limited. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -1251,7 +1252,7 @@ = class Build(): (AutoGenObject.BuildTarget, AutoGenObject= .ToolChain, AutoGenObject.Arch), ExtraData=3Dstr(AutoGenObject)) =20 - makefile =3D GenMake.BuildFile(AutoGenObject)._FILE_NAME_[GenMake= .gMakeType] + makefile =3D GenMake.BuildFile(AutoGenObject).getMakefileName() =20 # run if Target =3D=3D 'run': @@ -2040,10 +2041,10 @@ class Build(): ModuleBuildDirectoryList =3D data_pipe.Get("ModuleBuildDirect= oryList") =20 for m_build_dir in LibraryBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile.getMakefileName())): return None for m_build_dir in ModuleBuildDirectoryList: - if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile._FILE_NAME_[GenMake.gMakeType])): + if not os.path.exists(os.path.join(m_build_dir,GenMake.Bu= ildFile.getMakefileName())): return None Wa =3D WorkSpaceInfo( workspacedir,active_p,target,toolchain,archlist -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'