From a0b169f1086acd0659f1b2572ce949f9fb97063e Mon Sep 17 00:00:00 2001 From: Gordon Steemson Date: Mon, 19 Feb 2024 20:46:12 -0800 Subject: [PATCH] extend/fileutils.rb: make the `make` convenience routine more robust --- Library/Homebrew/extend/fileutils.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb index 3c2fd12f2e..6e59f5dede 100644 --- a/Library/Homebrew/extend/fileutils.rb +++ b/Library/Homebrew/extend/fileutils.rb @@ -96,17 +96,17 @@ def rake(*args) system RUBY_BIN/"rake", *args end - # Run `make` 3.81 or newer. - # Uses the system make on Leopard and newer, and the - # path to the actually-installed make on Tiger or older. + # Run `make` 3.81 or newer. Uses system make from Leopard onward, otherwise brewed make. def make(*args) if Utils.popen_read("/usr/bin/make", "--version").match(/Make (\d\.\d+)/)[1] > "3.80" - system "/usr/bin/make", *args + _make = "/usr/bin/make" + elsif Formula["make"].installed? + _make = Formula["make"].opt_bin/"make" + _make = _make.exist? ? _make.to_s : Formula["make"].opt_bin/"gmake".to_s else - make = Formula["make"].opt_bin/"make" - make_path = make.exist? ? make.to_s : (Formula["make"].opt_bin/"gmake").to_s - system make_path, *args + abort "Your system’s Make program is too old. Please install the “make” package." end + system _make, *args end if method_defined?(:ruby)