From 7845ab1bc9e92fa8e5db06bea8928a4646a19976 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 21 Aug 2024 20:43:56 +0900 Subject: [PATCH] [Bug #20687] Exclude just built ruby as baseruby On Windows, an executable file in the current directory has the priority to the PATH environment variable always. --- win32/Makefile.sub | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 46df464232..aad64ca8f1 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -18,8 +18,11 @@ MFLAGS=-l !endif !if "$(BASERUBY)" == "" -! if [ruby $(tooldir)/missing-baseruby.bat 2> nul] -! else if [for %I in (ruby.exe) do @echo BASERUBY = %~s$$PATH:I > baseruby.mk] +# After `nmake`, just built `ruby.exe` exists in the build directory, +# and is searched first prior to $PATH. Assume that no ruby +# executable in $(tooldir). +! if [cd $(tooldir) && ruby missing-baseruby.bat 2> nul] +! else if [(cd $(tooldir) && for %I in (ruby.exe) do @echo BASERUBY = %~s$$PATH:I) > baseruby.mk] ! else ! include baseruby.mk ! endif