cleanup and refactor error handling
[rainbows.git] / local.mk.sample
blob3672c89df5bcc3f7f0b5995c509f0bd75ef7faeb
1 # this is the local.mk file used by Eric Wong on his dev boxes.
2 # GNUmakefile will source local.mk in the top-level source tree
3 # if it is present.
5 # This is depends on a bunch of GNU-isms from bash, sed, touch.
7 DLEXT := so
8 gems := rack-1.0.1
9 # gems += unicorn-0.95.0 # installed via setup.rb
10 gems += rev-0.3.1 iobuffer-0.1.1
11 gems += eventmachine-0.12.10
12 gems += async_sinatra-0.1.5 sinatra-0.9.4
14 # Avoid loading rubygems to speed up tests because gmake is
15 # fork+exec heavy with Ruby.
16 prefix = $(HOME)
17 ifeq ($(r19),)
18   RUBY := $(prefix)/bin/ruby
19   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.8/gems/,$(gems))
20 else
21   prefix := $(prefix)/ruby-1.9
22   export PATH := $(prefix)/bin:$(PATH)
23   RUBY := $(prefix)/bin/ruby --disable-gems
24   gems += case-0.5 revactor-0.1.5
25   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems))
26 endif
28 ifdef gem_paths
29   sp :=
30   sp +=
31   export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths)))
32 endif
34 # pipefail is THE reason to use bash (v3+) or never revisions of ksh93
35 # SHELL := /bin/bash -e -o pipefail
36 SHELL := /bin/ksh93 -e -o pipefail
38 # trace execution of tests
39 # TRACER = strace -f -o $(t_pfx).strace -s 100000
40 TRACER = /usr/bin/time -v -o $(t_pfx).time
42 full-test: test-18 test-19
43 test-18:
44         $(MAKE) test 2>&1 | sed -u -e 's!^!1.8 !'
45 test-19:
46         $(MAKE) test r19=t 2>&1 | sed -u -e 's!^!1.9 !'
48 latest: NEWS
49         @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' < $<
51 # publishes docs to http://rainbows.rubyforge.org
52 publish_doc:
53         -git set-file-times
54         $(RM) -r doc
55         $(MAKE) doc
56         $(MAKE) -s latest > doc/LATEST
57         find doc/images doc/js -type f | \
58                 TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
59         $(MAKE) doc_gz
60         chmod 644 $$(find doc -type f)
61         rsync -av --delete doc/ \
62           rubyforge.org:/var/www/gforge-projects/rainbows/
63         git ls-files | xargs touch
65 # Create gzip variants of the same timestamp as the original so nginx
66 # "gzip_static on" can serve the gzipped versions directly.
67 doc_gz: suf := html js css
68 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
69 doc_gz:
70         touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
71         for i in $(docs); do \
72           gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
74 # launches any of the following shells with RUBYLIB set
75 irb sh bash ksh:
76         $@