Rakefile: kill raa_update task
[metropolis.git] / GNUmakefile
blob48558bdb768b84976cd984a69aad29fd465159b3
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 else
111 gem install-gem: GIT-VERSION-FILE
112 $(MAKE) $@ VERSION=$(GIT_VERSION)
113 endif
115 all:: test
117 test_units := $(wildcard test/test_*.rb)
118 test: test-unit
119 test-unit: $(test_units)
120 $(test_units):
121 $(RUBY) -I lib $@
123 # this requires GNU coreutils variants
124 publish_doc:
125 -git set-file-times
126 $(RM) -r doc
127 $(MAKE) doc
128 find doc/images -type f | \
129 TZ=UTC xargs touch -d '1970-01-01 00:00:02' doc/rdoc.css
130 $(MAKE) doc_gz
131 chmod 644 $$(find doc -type f)
132 $(RSYNC) -av doc/ metropolis.bogomips.org:/srv/metropolis/
133 git ls-files | xargs touch
135 # Create gzip variants of the same timestamp as the original so nginx
136 # "gzip_static on" can serve the gzipped versions directly.
137 doc_gz: docs = $(shell find doc -type f ! -regex '^.*\.\(gif\|jpg\|png\|gz\)$$')
138 doc_gz:
139 for i in $(docs); do \
140 gzip --rsyncable -9 < $$i > $$i.gz; touch -r $$i $$i.gz; done
142 .PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test $(test_units)