about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-26 19:13:41 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-26 19:15:59 -0700
commitfcc18638d01f50ba02621a6eaa2cf11be47d4d26 (patch)
treec647361c77f0bfdc11b268b55798cfb4b69a8d73
parentbaac7113683af010b8e81f1f3df1d677f7101951 (diff)
Using a "+" suffix alone was not enough protection since we use
evil recursive makes and can't share dependency info with parent
makes.  While this could be done more efficiently (even with
recursive make), but it'd be harder to maintain.  So we generate
the dependencies later to and sacrifice efficiency on the
initial run (but rarely/never again).
-rw-r--r--t/GNUmakefile18
1 files changed, 10 insertions, 8 deletions
diff --git a/t/GNUmakefile b/t/GNUmakefile
index d1b09cf..5129944 100644
--- a/t/GNUmakefile
+++ b/t/GNUmakefile
@@ -2,6 +2,8 @@
 
 all::
 
+pid := $(shell echo $$PPID)
+
 RUBY = $(ruby)
 rainbows_lib := $(shell cd ../lib && pwd)
 -include ../local.mk
@@ -63,13 +65,13 @@ endif
 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)")' $@+
-        mv $@+ $@
+        install -m 755 $^ $@.$(pid)
+        $(RUBY) -i -p -e '$$_.gsub!(%r{^#!.*$$},"#!$(ruby_bin)")' $@.$(pid)
+        mv $@.$(pid) $@
 
 random_blob:
-        dd if=/dev/urandom bs=1M count=30 of=$@+
-        mv $@+ $@
+        dd if=/dev/urandom bs=1M count=30 of=$@.$(pid)
+        mv $@.$(pid) $@
 
 $(T): random_blob
 
@@ -77,10 +79,10 @@ dependencies := socat curl
 deps := $(addprefix .dep+,$(dependencies))
 $(deps): dep_bin = $(lastword $(subst +, ,$@))
 $(deps):
-        @which $(dep_bin) > $@+ 2>/dev/null || :
-        @test -s $@+ || \
+        @which $(dep_bin) > $@.$(pid) 2>/dev/null || :
+        @test -s $@.$(pid) || \
           { echo >&2 "E `$(dep_bin)' not found in PATH=$(PATH)"; exit 1; }
-        @mv $@+ $@
+        @mv $@.$(pid) $@
 dep: $(deps)
 
 $(MODEL_T): export model = $(firstword $(subst ., ,$@))