local.mk.sample: add a hint for TMPDIR
[rainbows.git] / local.mk.sample
blob7180bbd3ef73cf39600b76050c920d46c8de86c4
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 RSYNC = rsync
8 DLEXT := so
10 # if you have a decent amount of RAM, setting TMPDIR to be on tmpfs
11 # can significantly improve performance because uploads take a lot
12 # of disk I/O due to the rewindability requirement in Rack.
13 # TMPDIR := /dev/shm
14 # export TMPDIR
16 # Avoid loading rubygems to speed up tests because gmake is
17 # fork+exec heavy with Ruby.
18 prefix = $(HOME)
20 ifeq ($(r192),)
21   ifeq ($(r19),)
22     RUBY := $(prefix)/bin/ruby
23   else
24     prefix := $(prefix)/ruby-1.9
25     export PATH := $(prefix)/bin:$(PATH)
26     RUBY := $(prefix)/bin/ruby --disable-gems
27   endif
28 else
29   prefix := $(prefix)/ruby-1.9.2
30   export PATH := $(prefix)/bin:$(PATH)
31   RUBY := $(prefix)/bin/ruby --disable-gems
32   gem_paths := $(addprefix $(prefix)/lib/ruby/gems/1.9.1/gems/,$(gems))
33 endif
35 ifndef NO_ISOLATE
36   x := $(shell test -d t/ && \
37          PATH=$(PATH) NO_ISOLATE=T $(MAKE) -s isolate RUBY:="$(RUBY)")
38 endif
40 RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
42 updir := $(shell git rev-parse --show-cdup)
43 gem_paths := $(wildcard $(updir)tmp/isolate/ruby-$(RUBY_VERSION)/gems/*-*)
45 ifdef gem_paths
46   sp :=
47   sp +=
48   export RUBYLIB := $(subst $(sp),:,$(addsuffix /lib,$(gem_paths)))
49 endif
51 # pipefail is THE reason to use bash (v3+) or never revisions of ksh93
52 # SHELL := /bin/bash -e -o pipefail
53 SHELL := /bin/ksh93 -e -o pipefail
55 # trace execution of tests
56 # TRACER = strace -f -o $(t_pfx).strace -s 100000
57 TRACER = /usr/bin/time -v -o $(t_pfx).time
59 full-test: test-18 test-191 test-192
60 test-18:
61         $(MAKE) test 2>&1 | sed -e 's!^!1.8 !'
62 test-191:
63         $(MAKE) test r19=T 2>&1 | sed -e 's!^!1.9.1 !'
64 test-192:
65         $(MAKE) test r192=T 2>&1 | sed -e 's!^!1.9.2 !'
67 latest: NEWS
68         @awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' < $<
70 # publishes docs to http://rainbows.rubyforge.org
71 publish_doc:
72         -git set-file-times
73         $(RM) -r doc ChangeLog NEWS
74         $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
75         $(MAKE) -s latest > doc/LATEST
76         find doc/images doc/js -type f | \
77                 TZ=UTC xargs touch -d '1970-01-01 00:00:00' doc/rdoc.css
78         $(MAKE) doc_gz
79         chmod 644 $$(find doc -type f)
80         $(RSYNC) -av doc/ rubyforge.org:/var/www/gforge-projects/rainbows/
81         $(RSYNC) -av doc/ dcvr:/srv/rainbows/
82         git ls-files | xargs touch
84 # Create gzip variants of the same timestamp as the original so nginx
85 # "gzip_static on" can serve the gzipped versions directly.
86 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
87 doc_gz:
88         touch doc/NEWS.atom.xml -d "$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
89         for i in $(docs); do \
90           gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
92 # launches any of the following shells with RUBYLIB set
93 irb sh bash ksh:
94         $@