about summary refs log tree commit homepage
path: root/local.mk.sample
diff options
context:
space:
mode:
Diffstat (limited to 'local.mk.sample')
-rw-r--r--local.mk.sample50
1 files changed, 34 insertions, 16 deletions
diff --git a/local.mk.sample b/local.mk.sample
index 84bcf44..5019576 100644
--- a/local.mk.sample
+++ b/local.mk.sample
@@ -5,40 +5,58 @@
 # This is depends on a bunch of GNU-isms from bash, sed, touch.
 
 DLEXT := so
-rack_ver := 1.0.0
+gems := rack-1.1.0
 
 # Avoid loading rubygems to speed up tests because gmake is
 # fork+exec heavy with Ruby.
+prefix = $(HOME)
 ifeq ($(r19),)
-  ruby := $(HOME)/bin/ruby
-  RUBYLIB := $(HOME)/lib/ruby/gems/1.8/gems/rack-$(rack_ver)/lib
+  RUBY := $(prefix)/bin/ruby
+  gem_paths := $(addprefix $(prefix)/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
-  RUBYLIB := $(HOME)/ruby-1.9/lib/ruby/gems/1.9.1/gems/rack-$(rack_ver)/lib
+  prefix := $(prefix)/ruby-1.9
+  export PATH := $(prefix)/bin:$(PATH)
+  RUBY := $(prefix)/bin/ruby --disable-gems
+  gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems))
 endif
 
-# pipefail is THE reason to use bash (v3+)
-SHELL := /bin/bash -e -o pipefail
+ifdef gem_paths
+  sp :=
+  sp +=
+  export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths)))
+endif
+
+# pipefail is THE reason to use bash (v3+) or never revisions of ksh93
+# SHELL := /bin/bash -e -o pipefail
+SHELL := /bin/ksh93 -e -o pipefail
 
 full-test: test-18 test-19
 test-18:
-        $(MAKE) test test-rails 2>&1 | sed -u -e 's!^!1.8 !'
+        $(MAKE) test test-rails 2>&1 | sed -e 's!^!1.8 !'
 test-19:
-        $(MAKE) test test-rails r19=1 2>&1 | sed -u -e 's!^!1.9 !'
+        $(MAKE) test test-rails r19=1 2>&1 | sed -e 's!^!1.9 !'
+
+latest: NEWS
+        @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' < $<
 
 # publishes docs to http://unicorn.bogomips.org
 publish_doc:
         -git set-file-times
-        $(MAKE) doc
+        $(RM) -r doc ChangeLog NEWS
+        $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
+        $(MAKE) -s latest > doc/LATEST
+        find doc/images doc/js -type f | \
+                TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
         $(MAKE) doc_gz
-        rsync -av --delete doc/ dcvr:/srv/unicorn/
+        tar cf - $$(git ls-files examples/) | (cd doc && tar xf -)
+        chmod 644 $$(find doc -type f)
+        rsync -av doc/ dcvr:/srv/unicorn/
         git ls-files | xargs touch
 
 # Create gzip variants of the same timestamp as the original so nginx
 # "gzip_static on" can serve the gzipped versions directly.
-doc_gz: suf := html js css
-doc_gz: globs := $(addprefix doc/*.,$(suf)) $(addprefix doc/*/*.,$(suf))
-doc_gz: docs := $(wildcard $(globs))
+doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
 doc_gz:
-        for i in $(docs); do gzip < $$i > $$i.gz; touch -r $$i $$i.gz; done
+        touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
+        for i in $(docs); do \
+          gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done