summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-10-08 08:49:22 +0000
committerEric Wong <normalperson@yhbt.net>2010-10-08 08:49:22 +0000
commitf20274e84169e18a73a5cd341b6bc31b625b83ce (patch)
tree93a251160bcdde87fce225e4709842e69f97ac6f
parent861481436b933bf4b8d647c43191c701651f16e4 (diff)
Automation is nice, the makefile needs some cleanup
-rw-r--r--GNUmakefile13
-rwxr-xr-xscript/isolate_for_tests8
-rw-r--r--t/GNUmakefile11
3 files changed, 15 insertions, 17 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 2a12667..5519e84 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -24,14 +24,11 @@ endif
 
 RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
 
-isolate_libs := tmp/isolate/.$(RUBY_ENGINE)-$(RUBY_VERSION).libs
-MYLIBS = $(RUBYLIB):$(shell cat $(isolate_libs) 2>/dev/null || \
-                      (test -f ./script/isolate_for_tests  && \
-                       $(RUBY) ./script/isolate_for_tests >/dev/null && \
-                       cat $(isolate_libs) 2>/dev/null))
-
-echo:
-        @echo $(MYLIBS)
+isolate_libs := tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk
+$(isolate_libs): script/isolate_for_tests
+        @$(RUBY) script/isolate_for_tests
+-include $(isolate_libs)
+MYLIBS = $(RUBYLIB):$(ISOLATE_LIBS)
 
 # dunno how to implement this as concisely in Ruby, and hell, I love awk
 awk_slow := awk '/def test_/{print FILENAME"--"$$2".n"}' 2>/dev/null
diff --git a/script/isolate_for_tests b/script/isolate_for_tests
index 7542557..ca63208 100755
--- a/script/isolate_for_tests
+++ b/script/isolate_for_tests
@@ -24,9 +24,11 @@ end
 _, status = Process.waitpid2(pid)
 status.success? or abort status.inspect
 lib_paths = Dir["#{opts[:path]}/gems/*-*/lib"].map { |x| File.expand_path(x) }
-libs = "tmp/isolate/.#{ruby_engine}-#{RUBY_VERSION}.libs"
-File.open("#{libs}.#$$", "w") { |fp| fp.puts lib_paths.join(':') }
-File.rename("#{libs}.#$$", libs)
+dst = "tmp/isolate/#{ruby_engine}-#{RUBY_VERSION}.mk"
+File.open("#{dst}.#$$", "w") do |fp|
+  fp.puts "ISOLATE_LIBS=#{lib_paths.join(':')}"
+end
+File.rename("#{dst}.#$$", dst)
 
 # pure Ruby gems can be shared across all Rubies
 %w(3.0.0).each do |rails_ver|
diff --git a/t/GNUmakefile b/t/GNUmakefile
index 9af9551..8f2668c 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -17,12 +17,11 @@ endif
 RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
 export RUBY_ENGINE
 
-isolate_libs := ../tmp/isolate/.$(RUBY_ENGINE)-$(RUBY_VERSION).libs
-MYLIBS := $(shell cat $(isolate_libs))
-ifeq ($(MY_LIBS),)
-  ignore := $(shell cd .. && $(RUBY) ./script/isolate_for_tests)
-  MYLIBS := $(shell cat $(isolate_libs))
-endif
+isolate_libs := ../tmp/isolate/$(RUBY_ENGINE)-$(RUBY_VERSION).mk
+$(isolate_libs): ../script/isolate_for_tests
+        @cd .. && $(RUBY) script/isolate_for_tests
+-include $(isolate_libs)
+MYLIBS := $(RUBYLIB):$(ISOLATE_LIBS)
 
 T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)