summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Jouan <tj@a13.fr>2015-03-15 16:17:57 +0000
committerThibault Jouan <tj@a13.fr>2015-03-16 17:01:06 +0000
commitb09761c41673f75d802f82a3acbc5bbcb5ae613a (patch)
tree006df79f6f5b422139b09affb423ed4d248ba036
parent94386a6cc0ef627399c2cad82004cb31ba373ed0 (diff)
downloadrake-compiler-b09761c41673f75d802f82a3acbc5bbcb5ae613a.tar.gz
Change make program detection with `make' fallback
Some platforms provide a working `make' program out of the box, but some versions of this program won't return a successful exit status code when given `-v' as argument. One such platform is FreeBSD, providing the `make' program in the base system which is based on `pmake'. This version won't accept `-v': $ make -v usage: make [-BeikNnqrstWwX] [-C directory] [-D variable] [-d flags] [-f makefile] [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file] [-V variable] [variable=value] [target ...] zsh: exit 2 make -v This change ensures detection with `gmake -v` or `make -v` will continue to work as expected, but adds a fallback on plain `make' when tested successfully with the `command' shell builtin.
-rw-r--r--lib/rake/extensiontask.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/rake/extensiontask.rb b/lib/rake/extensiontask.rb
index 2043299..9b4bd43 100644
--- a/lib/rake/extensiontask.rb
+++ b/lib/rake/extensiontask.rb
@@ -6,6 +6,11 @@ require "rubygems/package_task"
module Rake
class ExtensionTask < BaseExtensionTask
+ MAKE_PROGRAM_DETECTION = {
+ 'gmake -v' => 'gmake',
+ 'make -v' => 'make',
+ 'command -v make' => 'make'
+ }.freeze
attr_accessor :config_script
attr_accessor :cross_compile
@@ -453,9 +458,9 @@ Java extension should be preferred.
if RUBY_PLATFORM =~ /mswin/ then
'nmake'
else
- ENV['MAKE'] || %w[gmake make].find { |c|
- system("#{c} -v >> #{dev_null} 2>&1")
- }
+ ENV['MAKE'] || MAKE_PROGRAM_DETECTION.find { |test, program|
+ system("#{test} >> #{dev_null} 2>&1")
+ }[1]
end
end