Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Rationalise makefile generation
Pierre: Thanks for your contribution. Do you verify below configurations? And, how do you verify Windows host + GCC make? 1. Windows Host + VS nmake 2. Windows Host + GCC make 3. Linux Host + GCC make. Thanks Liming > -Original Message- > From: Pierre Gondois > Sent: Thursday, January 23, 2020 1:37 AM > To: Pierre Gondois ; devel@edk2.groups.io > Cc: Feng, Bob C ; Gao, Liming ; > Sami Mujawar ; nd > > Subject: RE: [PATCH v1 1/1] BaseTools: Rationalise makefile generation > > Hello Bob and Liming, > Just to let you know, I created a Bugzilla here on the same topic: > https://bugzilla.tianocore.org/show_bug.cgi?id=2481 > > Regards, > Pierre > > -Original Message- > From: PierreGondois > Sent: 13 January 2020 14:41 > To: devel@edk2.groups.io > Cc: Pierre Gondois ; bob.c.f...@intel.com; > liming@intel.com; Sami Mujawar > ; pierre.gondois@arm.co...@arm.com > Subject: [PATCH v1 1/1] BaseTools: Rationalise makefile generation > > 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 detected, the makefile generated is of Nmake type. Otherwise a > GNUmake type is generated. > > 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 = DEF(VS2017_BIN_HOST)\nmake.exe while for GCC5 it is > setup to use GNU make. > *_GCC5_*_MAKE_PATH = 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 > generated 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_BaseTools_Rationalise_makefile_generation_v1 > > Notes: > v1: > - Rationalise makefile generation [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 > fe94f9a4c232bb599a59563444c3985700c78ec6..640b562257f74a45b38b8c857dae4750f7c286e0 > 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 - 2018, > Intel Corporation. All rights reserved. > +# Copyright (c) 2020, ARM Limited. All rights reserved. > # SPDX-License-Identifier: BSD-2-Clause-Patent # > > @@ -52,13 +53,6 @@ gIncludeMacroConversion = { >"EFI_PPI_DEPENDENCY" : gPpiDefinition, > } > > -## default makefile type > -gMakeType = "" > -if sys.platform == "win32": > -gMakeType = "nmake" > -else: > -gMakeType = "gmake" > - > > ## BuildFile class > # > @@ -77,6 +71,13 @@ class BuildFile(object): > "gmake" : "GNUmakefile" > } > > +# 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 = '''# > # DO NOT EDIT > @@ -106,7 +107,7 @@ class BuildFile(object): > # $(RD) remove dir command > # > _SHELL_CMD_ = { > -"nmake" : { > +"win32" : { > "CP": "copy /y", > "MV": "move /y", > "RM": "del /f /q", > @@ -114,7 +115,7 @@ class BuildFile(object): > "RD": "rmdir /s /q", > }, > > -"gmake" : { > +"posix" : { > "CP": "cp -f", > "MV": "mv -f", > "RM": "rm -f", > @@ -125,35 +126,35 @@ class BuildFile(object): > > ## directory separator > _SEP_ = { > -"nmake" : "\\", > -"gmake" : "/" > +"win32" : "\\", > +"posix" : "/" > } > > ## directory creation template > _MD_TEMPLATE_ = { > -"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" > } > > ## directory removal template > _RD_TEMPLATE_ = { > -"nmake" : 'if exist %(dir)s $(RD) %(dir)s', > -"gmake" : "$(RD) %(dir)s" > +"win32" : 'if exist %(dir)s $(RD) %(dir)s', > +"posix" : "$(RD) %(dir)s"
Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Rationalise makefile generation
Hello Bob and Liming, Just to let you know, I created a Bugzilla here on the same topic: https://bugzilla.tianocore.org/show_bug.cgi?id=2481 Regards, Pierre -Original Message- From: PierreGondois Sent: 13 January 2020 14:41 To: devel@edk2.groups.io Cc: Pierre Gondois ; bob.c.f...@intel.com; liming@intel.com; Sami Mujawar ; pierre.gondois@arm.co...@arm.com Subject: [PATCH v1 1/1] BaseTools: Rationalise makefile generation 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 detected, the makefile generated is of Nmake type. Otherwise a GNUmake type is generated. 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 = DEF(VS2017_BIN_HOST)\nmake.exe while for GCC5 it is setup to use GNU make. *_GCC5_*_MAKE_PATH = 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 generated 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_BaseTools_Rationalise_makefile_generation_v1 Notes: v1: - Rationalise makefile generation [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 fe94f9a4c232bb599a59563444c3985700c78ec6..640b562257f74a45b38b8c857dae4750f7c286e0 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 - 2018, Intel Corporation. All rights reserved. +# Copyright (c) 2020, ARM Limited. All rights reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -52,13 +53,6 @@ gIncludeMacroConversion = { "EFI_PPI_DEPENDENCY" : gPpiDefinition, } -## default makefile type -gMakeType = "" -if sys.platform == "win32": -gMakeType = "nmake" -else: -gMakeType = "gmake" - ## BuildFile class # @@ -77,6 +71,13 @@ class BuildFile(object): "gmake" : "GNUmakefile" } +# 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 = '''# # DO NOT EDIT @@ -106,7 +107,7 @@ class BuildFile(object): # $(RD) remove dir command # _SHELL_CMD_ = { -"nmake" : { +"win32" : { "CP": "copy /y", "MV": "move /y", "RM": "del /f /q", @@ -114,7 +115,7 @@ class BuildFile(object): "RD": "rmdir /s /q", }, -"gmake" : { +"posix" : { "CP": "cp -f", "MV": "mv -f", "RM": "rm -f", @@ -125,35 +126,35 @@ class BuildFile(object): ## directory separator _SEP_ = { -"nmake" : "\\", -"gmake" : "/" +"win32" : "\\", +"posix" : "/" } ## directory creation template _MD_TEMPLATE_ = { -"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" } ## directory removal template _RD_TEMPLATE_ = { -"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_ = { -"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" } _CD_TEMPLATE_ = { -"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" } _MAKE_TEMPLATE_ = { -"nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s', -"gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s' +"win32" : '
[edk2-devel] [PATCH v1 1/1] BaseTools: Rationalise makefile generation
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 detected, the makefile generated is of Nmake type. Otherwise a GNUmake type is generated. 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 = DEF(VS2017_BIN_HOST)\nmake.exe while for GCC5 it is setup to use GNU make. *_GCC5_*_MAKE_PATH = 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 generated 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_BaseTools_Rationalise_makefile_generation_v1 Notes: v1: - Rationalise makefile generation [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 fe94f9a4c232bb599a59563444c3985700c78ec6..640b562257f74a45b38b8c857dae4750f7c286e0 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 - 2018, Intel Corporation. All rights reserved. +# Copyright (c) 2020, ARM Limited. All rights reserved. # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -52,13 +53,6 @@ gIncludeMacroConversion = { "EFI_PPI_DEPENDENCY" : gPpiDefinition, } -## default makefile type -gMakeType = "" -if sys.platform == "win32": -gMakeType = "nmake" -else: -gMakeType = "gmake" - ## BuildFile class # @@ -77,6 +71,13 @@ class BuildFile(object): "gmake" : "GNUmakefile" } +# 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 = '''# # DO NOT EDIT @@ -106,7 +107,7 @@ class BuildFile(object): # $(RD) remove dir command # _SHELL_CMD_ = { -"nmake" : { +"win32" : { "CP": "copy /y", "MV": "move /y", "RM": "del /f /q", @@ -114,7 +115,7 @@ class BuildFile(object): "RD": "rmdir /s /q", }, -"gmake" : { +"posix" : { "CP": "cp -f", "MV": "mv -f", "RM": "rm -f", @@ -125,35 +126,35 @@ class BuildFile(object): ## directory separator _SEP_ = { -"nmake" : "\\", -"gmake" : "/" +"win32" : "\\", +"posix" : "/" } ## directory creation template _MD_TEMPLATE_ = { -"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" } ## directory removal template _RD_TEMPLATE_ = { -"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_ = { -"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" } _CD_TEMPLATE_ = { -"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" } _MAKE_TEMPLATE_ = { -"nmake" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s', -"gmake" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s' +"win32" : 'if exist %(file)s "$(MAKE)" $(MAKE_FLAGS) -f %(file)s', +"posix" : 'test -e %(file)s && "$(MAKE)" $(MAKE_FLAGS) -f %(file)s' } _INCLUDE_CMD_ = { @@ -169,22 +170,30 @@ class BuildFile(object): # def __init__(self, AutoGenObject): self._AutoGenObject = AutoGenObject -self._FileType = gMakeType -## Create build file +MakePath = AutoGenObject.BuildOption.get('MAKE', {}).get('PATH') +