about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-24 10:28:13 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-24 10:51:45 -0700
commitbd8912c86fc3ef617e72e4cf59fb308dc06563ba (patch)
tree38454a2fc9f6b3520c44db3fed0d49d13cf522ac
parentccd4681cdd361f00b86d29e9d1b1ccae0e7d5079 (diff)
downloadrainbows-bd8912c86fc3ef617e72e4cf59fb308dc06563ba.tar.gz
It's more common form for externally-visible/modifiable
variables in Makefiles and shell scripts.
-rw-r--r--GNUmakefile18
-rw-r--r--local.mk.sample4
-rw-r--r--t/GNUmakefile10
-rwxr-xr-xt/test-lib.sh6
4 files changed, 22 insertions, 16 deletions
diff --git a/GNUmakefile b/GNUmakefile
index bc870ef..6fc7103 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,6 +1,6 @@
 # use GNU Make to run tests in parallel, and without depending on Rubygems
 all::
-ruby = ruby
+RUBY = ruby
 rake = rake
 GIT_URL = git://git.bogomips.org/rainbows.git
 
@@ -8,11 +8,17 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
         @./GIT-VERSION-GEN
 -include GIT-VERSION-FILE
 -include local.mk
+ifdef ruby
+  ifeq ($(RUBY),ruby)
+    $(warning ruby variable is deprecated, use RUBY instead)
+    RUBY = $(ruby)
+  endif
+endif
 ifeq ($(DLEXT),) # "so" for Linux
-  DLEXT := $(shell $(ruby) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
+  DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
 endif
 ifeq ($(RUBY_VERSION),)
-  RUBY_VERSION := $(shell $(ruby) -e 'puts RUBY_VERSION')
+  RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
 endif
 
 base_bins := rainbows
@@ -25,7 +31,7 @@ install: $(bins)
         $(RM) -r .install-tmp
         mkdir .install-tmp
         cp -p bin/* .install-tmp
-        $(ruby) setup.rb all
+        $(RUBY) setup.rb all
         $(RM) $^
         mv .install-tmp/* bin/
         $(RM) -r .install-tmp
@@ -82,10 +88,10 @@ doc: .document NEWS ChangeLog
         cd doc && for i in $(base_bins); do \
           sed -e '/"documentation">/r man1/'$$i'.1.html' \
                 < $${i}_1.html > tmp && mv tmp $${i}_1.html; done
-        $(ruby) -i -p -e \
+        $(RUBY) -i -p -e \
           '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
           doc/ChangeLog.html
-        $(ruby) -i -p -e \
+        $(RUBY) -i -p -e \
           '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
           doc/NEWS.html doc/README.html
         $(rake) -s news_atom > doc/NEWS.atom.xml
diff --git a/local.mk.sample b/local.mk.sample
index da181b6..59a8e6a 100644
--- a/local.mk.sample
+++ b/local.mk.sample
@@ -10,11 +10,11 @@ gems := rev-0.3.1 rack-1.0.0 iobuffer-0.1.1
 # Avoid loading rubygems to speed up tests because gmake is
 # fork+exec heavy with Ruby.
 ifeq ($(r19),)
-  ruby := $(HOME)/bin/ruby
+  RUBY := $(HOME)/bin/ruby
   gem_paths := $(addprefix $(HOME)/lib/ruby/gems/1.8/gems/,$(gems))
 else
   export PATH := $(HOME)/ruby-1.9/bin:$(PATH)
-  ruby := $(HOME)/ruby-1.9/bin/ruby --disable-gems
+  RUBY := $(HOME)/ruby-1.9/bin/ruby --disable-gems
   gems := $(gems) case-0.5 revactor-0.1.4
   gem_paths := $(addprefix $(HOME)/ruby-1.9/lib/ruby/gems/1.9.1/gems/,$(gems))
 endif
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 16f6e36..e4e4f5a 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -2,11 +2,11 @@
 
 all::
 
-ruby = ruby
+RUBY = ruby
 rainbows_lib := $(shell cd ../lib && pwd)
 -include ../local.mk
 ifeq ($(RUBY_VERSION),)
-  RUBY_VERSION := $(shell $(ruby) -e 'puts RUBY_VERSION')
+  RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
 endif
 
 ifeq ($(RUBYLIB),)
@@ -50,11 +50,11 @@ endif
 
 run_test = $(quiet_pre) ( $(t_wrap) ) $(quiet_post)
 
-test-bin-$(RUBY_VERSION)/rainbows: ruby_bin = $(shell which $(ruby))
+test-bin-$(RUBY_VERSION)/rainbows: ruby_bin = $(shell which $(RUBY))
 test-bin-$(RUBY_VERSION)/rainbows: ../bin/rainbows
         mkdir -p $(@D)
         install -m 755 $^ $@+
-        $(ruby) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@+
+        $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@+
         mv $@+ $@
 
 req_random_blob := $(wildcard t?1??-*.sh)
@@ -65,7 +65,7 @@ random_blob:
 $(req_random_blob): random_blob
 
 $(T): trash/.gitignore
-$(T): export ruby := $(ruby)
+$(T): export RUBY := $(RUBY)
 $(T): export PATH := $(CURDIR)/test-bin-$(RUBY_VERSION):$(PATH)
 $(T): test-bin-$(RUBY_VERSION)/rainbows
         $(run_test)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 34f0de1..b4ece30 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -27,8 +27,8 @@ then
         esac
 fi
 
-ruby="${ruby-'ruby'}"
-RUBY_VERSION=${RUBY_VERSION-$($ruby -e 'puts RUBY_VERSION')}
+RUBY="${RUBY-ruby}"
+RUBY_VERSION=${RUBY_VERSION-$($RUBY -e 'puts RUBY_VERSION')}
 t_pfx=$PWD/trash/$T-$RUBY_VERSION
 set -u
 
@@ -76,7 +76,7 @@ wait_for_pid () {
 require_check () {
         lib=$1
         const=$2
-        if ! $ruby -r$lib -e "puts $const" >/dev/null 2>&1
+        if ! $RUBY -r$lib -e "puts $const" >/dev/null 2>&1
         then
                 echo >&2 "skipping $T since we don't have $lib"
                 exit 0