summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
diff options
context:
space:
mode:
authorPierre Gondois <pierre.gondois@arm.com>2020-02-10 18:49:07 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-02-12 02:34:44 +0000
commit818283de3f6d3b288deda54f0734be5bb70ddd5a (patch)
treeba30c9f6974f183d5db7aeadb8a4893e9330d85d /BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
parente465aae055258457e91ce2d3fef87d25507c5b24 (diff)
downloadedk2-818283de3f6d3b288deda54f0734be5bb70ddd5a.tar.gz
edk2-818283de3f6d3b288deda54f0734be5bb70ddd5a.tar.bz2
edk2-818283de3f6d3b288deda54f0734be5bb70ddd5a.zip
BaseTools: Rationalise makefile generation
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 <TARGET>_<TAGNAME>_<ARCH>_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 <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/IncludesAutoGen.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/IncludesAutoGen.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py b/BaseTools/Source/Python/AutoGen/IncludesAutoGen.py
index 1ca1798907..ca9e02d19b 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 - 2020, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2020, ARM Limited. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
from Common.caching import cached_property
@@ -12,20 +13,6 @@ from Common.Misc import SaveFileOnChange, PathClass
from Common.Misc import TemplateString
import sys
gIsFileMap = {}
-if sys.platform == "win32":
- _INCLUDE_DEPS_TEMPLATE = TemplateString('''
-${BEGIN}
-!IF EXIST(${deps_file})
-!INCLUDE ${deps_file}
-!ENDIF
-${END}
- ''')
-else:
- _INCLUDE_DEPS_TEMPLATE = TemplateString('''
-${BEGIN}
--include ${deps_file}
-${END}
- ''')
DEP_FILE_TAIL = "# Updated \n"
@@ -59,6 +46,25 @@ class IncludesAutoGen():
def CreateDepsInclude(self):
deps_file = {'deps_file':self.deps_files}
+
+ MakePath = self.module_autogen.BuildOption.get('MAKE', {}).get('PATH')
+ if not MakePath:
+ EdkLogger.error("build", PARAMETER_MISSING, Message="No Make path available.")
+ elif "nmake" in MakePath:
+ _INCLUDE_DEPS_TEMPLATE = TemplateString('''
+ ${BEGIN}
+ !IF EXIST(${deps_file})
+ !INCLUDE ${deps_file}
+ !ENDIF
+ ${END}
+ ''')
+ else:
+ _INCLUDE_DEPS_TEMPLATE = TemplateString('''
+ ${BEGIN}
+ -include ${deps_file}
+ ${END}
+ ''')
+
try:
deps_include_str = _INCLUDE_DEPS_TEMPLATE.Replace(deps_file)
except Exception as e: