socket/pure_ruby: reduce Errno::EAGAIN exceptions
[ruby-mogilefs-client.git] / GNUmakefile
blob6d5d14279df22ffb672089e096ff0e1b9bec540b
1 # use GNU Make to run tests in parallel, and without depending on Rubygems
2 all:: test
3 RSYNC_DEST := bogomips.org:/srv/bogomips/mogilefs-client
5 T := $(wildcard test/test*.rb)
6 TO := $(subst .rb,.log,$(T))
8 test: $(T)
9 @cat $(TO) | ruby test/aggregate.rb
10 @$(RM) $(TO)
11 clean:
12 $(RM) $(TO) $(addsuffix +,$(TO))
15 ifndef V
16 quiet_pre = @echo '* $@';
17 quiet_post = >$(t) 2>&1
18 else
19 # we can't rely on -o pipefail outside of bash 3+,
20 # so we use a stamp file to indicate success and
21 # have rm fail if the stamp didn't get created
22 stamp = $@$(log_suffix).ok
23 quiet_pre = @echo $(ruby) $@ $(TEST_OPTS); ! test -f $(stamp) && (
24 quiet_post = && > $(stamp) )>&2 | tee $(t); rm $(stamp) 2>/dev/null
25 endif
26 ruby = ruby
27 run_test = $(quiet_pre) setsid $(ruby) -w $@ $(TEST_OPTS) $(quiet_post) || \
28 (sed "s,^,$(extra): ," >&2 < $(t); exit 1)
30 $(T): t = $(subst .rb,.log,$@)
31 $(T): export RUBYLIB := $(CURDIR)/lib:$(RUBYLIB)
32 $(T):
33 $(run_test)
35 # using make instead of rake since Rakefile takes too long to load
36 manifest: Manifest.txt
37 Manifest.txt:
38 git ls-files > $@+
39 cmp $@+ $@ || mv $@+ $@
40 $(RM) -f $@+
42 package: manifest
43 git diff --exit-code HEAD^0
44 $(RM) -r pkg/
45 rake fix_perms
46 rake package
48 libs := $(wildcard lib/*.rb lib/*/*.rb)
49 flay_flags =
50 flog_flags =
51 flay: $(libs)
52 flay $(flay_flags) $^
53 flog: $(libs)
54 flog $(flog_flags) $^
55 .PHONY: $(T) Manifest.txt
57 check-warnings:
58 @(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
59 do ruby -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :
60 RSYNC = rsync
61 WRONGDOC = wrongdoc
63 doc:: .document .wrongdoc.yml $(pkg_extra)
64 -find lib -type f -name '*.rbc' -exec rm -f '{}' ';'
65 $(RM) -r doc
66 $(WRONGDOC) all
67 install -m644 $(shell LC_ALL=C grep '^[A-Z]' .document) doc/
68 cd doc && \
69 ln -s README README.txt && \
70 ln -s README.html README_txt.html && \
71 ln -s LICENSE LICENSE.txt && \
72 ln -s LICENSE.html LICENSE_txt.html && \
73 ln -s History History.txt && \
74 ln -s History.html History_txt.html
76 # Create gzip variants of the same timestamp as the original so nginx
77 # "gzip_static on" can serve the gzipped versions directly.
78 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
79 doc_gz:
80 for i in $(docs); do \
81 gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
83 # this requires GNU coreutils variants
84 ifneq ($(RSYNC_DEST),)
85 publish_doc:
86 -git set-file-times
87 $(MAKE) doc
88 find doc/images -type f | \
89 TZ=UTC xargs touch -d '1970-01-01 00:00:06' doc/rdoc.css
90 $(MAKE) doc_gz
91 $(RSYNC) -av doc/ $(RSYNC_DEST)/
92 git ls-files | xargs touch
93 endif
95 .PHONY: doc