doc: update Static_Files documentation page
[rainbows.git] / GNUmakefile
blob55d55e64b3ce61b84972178389a2e35bc3c3d4d1
1 # use GNU Make to run tests in parallel, and without depending on RubyGems
2 all::
3 MRI = ruby
4 RUBY = ruby
5 RAKE = rake
6 RSYNC = rsync
7 GIT_URL = git://git.bogomips.org/rainbows.git
9 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
10 @./GIT-VERSION-GEN
11 -include GIT-VERSION-FILE
12 -include local.mk
13 ifeq ($(DLEXT),) # "so" for Linux
14 DLEXT := $(shell $(RUBY) -rrbconfig -e 'puts Config::CONFIG["DLEXT"]')
15 endif
16 ifeq ($(RUBY_VERSION),)
17 RUBY_VERSION := $(shell $(RUBY) -e 'puts RUBY_VERSION')
18 endif
19 RUBY_ENGINE := $(shell $(RUBY) -e 'puts((RUBY_ENGINE rescue "ruby"))')
21 base_bins := rainbows
22 bins := $(addprefix bin/, $(base_bins))
23 man1_rdoc := $(addsuffix _1, $(base_bins))
24 man1_bins := $(addsuffix .1, $(base_bins))
25 man1_paths := $(addprefix man/man1/, $(man1_bins))
27 install: $(bins)
28 $(prep_setup_rb)
29 $(RM) -r .install-tmp
30 mkdir .install-tmp
31 cp -p bin/* .install-tmp
32 $(RUBY) setup.rb all
33 $(RM) $^
34 mv .install-tmp/* bin/
35 $(RM) -r .install-tmp
36 $(prep_setup_rb)
38 setup_rb_files := .config InstalledFiles
39 prep_setup_rb := @-$(RM) $(setup_rb_files);$(MAKE) -C $(ext) clean
41 clean:
42 -$(MAKE) -C $(ext) clean
43 -$(MAKE) -C Documentation clean
44 $(RM) $(setup_rb_files) $(t_log)
46 man:
47 $(MAKE) -C Documentation install-man
49 pkg_extra := GIT-VERSION-FILE NEWS ChangeLog
50 manifest: $(pkg_extra) man
51 $(RM) .manifest
52 $(MAKE) .manifest
54 .manifest:
55 (git ls-files && \
56 for i in $@ $(pkg_extra) $(man1_paths); \
57 do echo $$i; done) | LC_ALL=C sort > $@+
58 cmp $@+ $@ || mv $@+ $@
59 $(RM) $@+
61 NEWS: GIT-VERSION-FILE
62 $(RAKE) -s news_rdoc > $@+
63 mv $@+ $@
65 SINCE = 0.94.0
66 ChangeLog: LOG_VERSION = \
67 $(shell git rev-parse -q "$(GIT_VERSION)" >/dev/null 2>&1 && \
68 echo $(GIT_VERSION) || git describe)
69 ChangeLog: log_range = v$(SINCE)..$(LOG_VERSION)
70 ChangeLog: GIT-VERSION-FILE
71 @echo "ChangeLog from $(GIT_URL) ($(log_range))" > $@+
72 @echo >> $@+
73 git log $(log_range) | sed -e 's/^/ /' >> $@+
74 mv $@+ $@
76 news_atom := http://rainbows.rubyforge.org/NEWS.atom.xml
77 cgit_atom := http://git.bogomips.org/cgit/rainbows.git/atom/?h=master
78 atom = <link rel="alternate" title="Atom feed" href="$(1)" \
79 type="application/atom+xml"/>
81 # using rdoc 2.5.x+
82 doc: .document NEWS ChangeLog
83 for i in $(man1_rdoc); do echo > $$i; done
84 find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
85 rdoc -t "$(shell sed -ne '1s/^= //p' README)"
86 install -m644 COPYING doc/COPYING
87 install -m644 $(shell grep '^[A-Z]' .document) doc/
88 $(MAKE) -C Documentation install-html install-man
89 install -m644 $(man1_paths) doc/
90 cd doc && for i in $(base_bins); do \
91 $(RM) 1.html $${i}.1.html; \
92 sed -e '/"documentation">/r man1/'$$i'.1.html' \
93 < $${i}_1.html > tmp && mv tmp $${i}_1.html; \
94 ln $${i}_1.html $${i}.1.html; \
95 done
96 $(MRI) -i -p -e \
97 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
98 doc/ChangeLog.html
99 $(MRI) -i -p -e \
100 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
101 doc/NEWS.html doc/README.html
102 $(RAKE) -s news_atom > doc/NEWS.atom.xml
103 cd doc && ln README.html tmp && mv tmp index.html
104 $(MAKE) -C Documentation comparison.html
105 $(MRI) -i -p -e \
106 '$$_.gsub!(/INCLUDE/){File.read("Documentation/comparison.html")}' \
107 doc/Summary.html
108 cat Documentation/comparison.css >> doc/rdoc.css
109 $(RM) $(man1_rdoc)
111 # publishes docs to http://rainbows.rubyforge.org
112 publish_doc: NEWS
113 -git set-file-times
114 $(RM) -r doc ChangeLog NEWS
115 $(MAKE) doc LOG_VERSION=$(shell git tag -l | tail -1)
116 awk 'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' \
117 < NEWS > doc/LATEST
118 -find doc/images doc/js -type f | \
119 TZ=UTC xargs touch -d '1970-01-01 00:00:01' doc/rdoc.css
120 chmod 644 $$(find doc -type f)
121 $(RSYNC) -av doc/ rubyforge.org:/var/www/gforge-projects/rainbows/
122 git ls-files | xargs touch
124 ifneq ($(VERSION),)
125 rfproject := rainbows
126 rfpackage := rainbows
127 pkggem := pkg/$(rfpackage)-$(VERSION).gem
128 pkgtgz := pkg/$(rfpackage)-$(VERSION).tgz
129 release_notes := release_notes-$(VERSION)
130 release_changes := release_changes-$(VERSION)
132 release-notes: $(release_notes)
133 release-changes: $(release_changes)
134 $(release_changes):
135 $(RAKE) -s release_changes > $@+
136 $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
137 $(release_notes):
138 GIT_URL=$(GIT_URL) $(RAKE) -s release_notes > $@+
139 $(VISUAL) $@+ && test -s $@+ && mv $@+ $@
141 # ensures we're actually on the tagged $(VERSION), only used for release
142 verify:
143 test x"$(shell umask)" = x0022
144 git rev-parse --verify refs/tags/v$(VERSION)^{}
145 git diff-index --quiet HEAD^0
146 test `git rev-parse --verify HEAD^0` = \
147 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
149 fix-perms:
150 -git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644
151 -git ls-tree -r HEAD | awk '/^100755 / {print $$NF}' | xargs chmod 755
153 gem: $(pkggem)
155 install-gem: $(pkggem)
156 gem install $(CURDIR)/$<
158 $(pkggem): manifest fix-perms
159 gem build $(rfpackage).gemspec
160 mkdir -p pkg
161 mv $(@F) $@
163 $(pkgtgz): distdir = $(basename $@)
164 $(pkgtgz): HEAD = v$(VERSION)
165 $(pkgtgz): manifest fix-perms
166 @test -n "$(distdir)"
167 $(RM) -r $(distdir)
168 mkdir -p $(distdir)
169 tar c `cat .manifest` | (cd $(distdir) && tar x)
170 cd pkg && tar c $(basename $(@F)) | gzip -9 > $(@F)+
171 mv $@+ $@
173 package: $(pkgtgz) $(pkggem)
175 release: verify package $(release_notes) $(release_changes)
176 # make tgz release on RubyForge
177 rubyforge add_release -f -n $(release_notes) -a $(release_changes) \
178 $(rfproject) $(rfpackage) $(VERSION) $(pkgtgz)
179 # push gem to RubyGems.org
180 gem push $(pkggem)
181 # in case of gem downloads from RubyForge releases page
182 -rubyforge add_file \
183 $(rfproject) $(rfpackage) $(VERSION) $(pkggem)
184 $(RAKE) raa_update VERSION=$(VERSION)
185 $(RAKE) fm_update VERSION=$(VERSION)
186 else
187 gem install-gem: GIT-VERSION-FILE
188 $(MAKE) $@ VERSION=$(GIT_VERSION)
189 endif
191 all:: test
192 test:
193 $(MAKE) -C t
195 .PHONY: .FORCE-GIT-VERSION-FILE doc manifest man test