tdb: remove "threadsafe" option
[metropolis.git] / GNUmakefile
blob2d05b074ffd154d528f581d8c26d22520c4c2263
1 # use GNU Make to run tests in parallel, and without depending on RubyGems
2 all::
3 RUBY = ruby
4 RAKE = rake
5 RSYNC = rsync
7 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
8 @./GIT-VERSION-GEN
9 -include GIT-VERSION-FILE
10 -include local.mk
11 ifeq ($(RUBY_VERSION),)
12 RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
13 endif
15 install: $(bins)
16 $(prep_setup_rb)
17 $(RM) -r .install-tmp
18 mkdir .install-tmp
19 cp -p bin/* .install-tmp
20 $(RUBY) setup.rb all
21 $(RM) $^
22 mv .install-tmp/* bin/
23 $(RM) -r .install-tmp
24 $(prep_setup_rb)
26 setup_rb_files := .config InstalledFiles
27 prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
29 clean:
30 $(RM) $(setup_rb_files)
32 pkg_extra := GIT-VERSION-FILE NEWS ChangeLog LATEST
33 manifest:
34 $(RM) .manifest
35 $(MAKE) .manifest
37 .manifest:
38 wrongdoc prepare
39 (git ls-files && for i in $@ $(pkg_extra);do echo $$i; done) | \
40 LC_ALL=C sort > $@+
41 cmp $@+ $@ || mv $@+ $@
42 $(RM) $@+
44 doc: .document .wrongdoc.yml
45 wrongdoc all
46 install -m644 COPYING doc/COPYING
47 install -m644 $(shell grep '^[A-Z]' .document) doc/
49 ifneq ($(VERSION),)
50 rfproject := rainbows
51 rfpackage := metropolis
52 pkggem := pkg/$(rfpackage)-$(VERSION).gem
53 pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
54 release_notes := release_notes-$(VERSION)
55 release_changes := release_changes-$(VERSION)
57 release-notes: $(release_notes)
58 release-changes: $(release_changes)
59 $(release_changes):
60 wrongdoc release_changes > $@+
61 $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
62 $(release_notes):
63 wrongdoc release_notes > $@+
64 $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
66 # ensures we're actually on the tagged $(VERSION), only used for release
67 verify:
68 test x"$(shell umask)" = x0022
69 git rev-parse --verify refs/tags/v$(VERSION)^{}
70 git diff-index --quiet HEAD^0
71 test `git rev-parse --verify HEAD^0` = \
72 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
74 fix-perms:
75 -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
76 -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
78 gem: $(pkggem)
80 install-gem: $(pkggem)
81 gem install $(CURDIR)/$<
83 $(pkggem): manifest fix-perms
84 gem build $(rfpackage).gemspec
85 mkdir -p pkg
86 mv $(@F) $@
88 $(pkgtgz): distdir = $(basename $@)
89 $(pkgtgz): HEAD = v$(VERSION)
90 $(pkgtgz): manifest fix-perms
91 @test -n "$(distdir)"
92 $(RM) -r $(distdir)
93 mkdir -p $(distdir)
94 tar cf - `cat .manifest` | (cd $(distdir) && tar x)
95 cd pkg && tar cf - $(basename $(@F)) | gzip -9 > $(@F)+
96 mv $@+ $@
98 package: $(pkgtgz) $(pkggem)
100 test-release: verify package $(release_notes) $(release_changes)
101 release: verify package $(release_notes) $(release_changes)
102 # make tgz release on RubyForge
103 rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
104 $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
105 # push gem to RubyGems.org
106 gem push $(pkggem)
107 # in case of gem downloads from RubyForge releases page
108 -rubyforge add_file \
109 $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
110 $(RAKE) raa_update VERSION=$(VERSION)
111 else
112 gem install-gem: GIT-VERSION-FILE
113 $(MAKE) $@ VERSION=$(GIT_VERSION)
114 endif
116 all:: test
118 test_units := $(wildcard test/test_*.rb)
119 test: test-unit
120 test-unit: $(test_units)
121 $(test_units):
122 $(RUBY) -I lib $@
124 # this requires GNU coreutils variants
125 publish_doc:
126 -git set-file-times
127 $(RM) -r doc
128 $(MAKE) doc
129 find doc/images -type f | \
130 TZ=UTC xargs touch -d '1970-01-01 00:00:02' doc/rdoc.css
131 $(MAKE) doc_gz
132 chmod 644 $$(find doc -type f)
133 $(RSYNC) -av doc/ metropolis.bogomips.org:/srv/metropolis/
134 git ls-files | xargs touch
136 # Create gzip variants of the same timestamp as the original so nginx
137 # "gzip_static on" can serve the gzipped versions directly.
138 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
139 doc_gz:
140 for i in $(docs); do \
141 gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
143 .PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test $(test_units)