[Lldb-commits] [lldb] [LLDB][test] Fix cmd.exe detection on recent Windows versions (PR #99532)

Vladislav Dzhidzhoev via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 18 13:19:05 PDT 2024


https://github.com/dzhidzhoev updated https://github.com/llvm/llvm-project/pull/99532

>From 17f92b90fff5132960037997b0ace4c17aaf93df Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Thu, 18 Jul 2024 19:27:55 +0200
Subject: [PATCH] [LLDB][test] Improve SHELL detection on Windows in
 Makefile.rules

In MinGW make, %windir% variable has a lowercase name $(windir) when
launched from cmd.exe, and $(WINDIR) name when launched from MSYS2,
since MSYS2 represents standard Windows environment variables in upper
case.

This commit makes Makefile.rules consider both run variants.
---
 lldb/packages/Python/lldbsuite/test/make/Makefile.rules | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 597aa94566c24..be3ad684dd736 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -55,8 +55,10 @@ LLDB_BASE_DIR := $(THIS_FILE_DIR)/../../../../../
 # Also reset BUILDDIR value because "pwd" returns cygwin or msys path
 # which needs to be converted to windows path.
 #----------------------------------------------------------------------
-ifeq "$(OS)" "Windows_NT"
-	SHELL = $(WINDIR)\system32\cmd.exe
+ifeq "$(HOST_OS)" "Windows_NT"
+	# MinGW make gets $(windir) variable if launched from cmd.exe
+	# and $(WINDIR) if launched from MSYS2.
+	SHELL := $(or $(windir),$(WINDIR),C:\WINDOWS)\system32\cmd.exe
 	BUILDDIR := $(shell echo %cd%)
 endif
 



More information about the lldb-commits mailing list