summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2025-12-16 23:33:10 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-12-24 05:03:38 +0300
commit79fdd2b82af96963cd38d157494df1668f16a281 (patch)
tree062c75d97b08557801b10729b74eb95339ba91ad /BaseTools/Source/Python/AutoGen
parent9fa1a35e56e028c786ebbf295bac769ed2559b9f (diff)
downloadedk2-79fdd2b82af96963cd38d157494df1668f16a281.tar.xz
BaseTools: GNUMakefiles must use CMD.EXE in Windows
Use $(OS) in all GNUMakefiles to detect if the GNUMakefile is being used in a Windows OS. If a Windows OS is detected, then override SHELL to use cmd.exe. This prevents make utility from using sh.exe if sh.exe happens to be in PATH. If sh.exe is used, then backslash (\) characters in file paths are removed and builds break for files not found. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rwxr-xr-xBaseTools/Source/Python/AutoGen/GenMake.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index e5f282c4ac..b729103efd 100755
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -98,10 +98,18 @@ class BuildFile(object):
#
'''
+ ## Fixed header string for makefile
+ _GMAKE_MAKEFILE_HEADER = '''
+ifeq (Windows, $(findstring Windows,$(OS)))
+ SHELL := cmd.exe
+endif
+ '''
+
+
## Header string for each type of build file
_FILE_HEADER_ = {
NMAKE_FILETYPE : _MAKEFILE_HEADER % _FILE_NAME_[NMAKE_FILETYPE],
- GMAKE_FILETYPE : _MAKEFILE_HEADER % _FILE_NAME_[GMAKE_FILETYPE]
+ GMAKE_FILETYPE : (_MAKEFILE_HEADER + _GMAKE_MAKEFILE_HEADER) % _FILE_NAME_[GMAKE_FILETYPE]
}
## shell commands which can be used in build file in the form of macro