1 # use GNU Make to run tests in parallel, and without depending on RubyGems
7 GIT_URL
= git
://git.bogomips.org
/rainbows.git
9 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
11 -include GIT-VERSION-FILE
13 ifeq ($(DLEXT
),) # "so" for Linux
14 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts Config::CONFIG["DLEXT"]')
16 ifeq ($(RUBY_VERSION
),)
17 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
19 RUBY_ENGINE
:= $(shell $(RUBY
) -e
'puts((RUBY_ENGINE rescue "ruby"))')
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
))
31 cp
-p bin
/* .install-tmp
34 mv .install-tmp
/* bin
/
38 setup_rb_files
:= .config InstalledFiles
39 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
42 -$(MAKE
) -C
$(ext
) clean
43 -$(MAKE
) -C Documentation
clean
44 $(RM
) $(setup_rb_files
) $(t_log
)
47 $(MAKE
) -C Documentation install-man
49 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
50 manifest
: $(pkg_extra
) man
56 for i in
$@
$(pkg_extra
) $(man1_paths
); \
57 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
58 cmp
$@
+ $@ || mv
$@
+ $@
61 NEWS
: GIT-VERSION-FILE
62 $(RAKE
) -s news_rdoc
> $@
+
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))" > $@
+
73 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
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"/>
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
-a
-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
; \
97 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
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
106 '$$_.gsub!(/INCLUDE/){File.read("Documentation/comparison.html")}' \
108 cat Documentation
/comparison.css
>> doc
/rdoc.css
111 # publishes docs to http://rainbows.rubyforge.org
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 }' \
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
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
)
135 $(RAKE
) -s release_changes
> $@
+
136 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
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
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)^{}`
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
155 install-gem
: $(pkggem
)
156 gem
install $(CURDIR
)/$<
158 $(pkggem
): manifest fix-perms
159 gem build
$(rfpackage
).gemspec
163 $(pkgtgz
): distdir
= $(basename $@
)
164 $(pkgtgz
): HEAD
= v
$(VERSION
)
165 $(pkgtgz
): manifest fix-perms
166 @
test -n
"$(distdir)"
169 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
170 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
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
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
)
187 gem install-gem
: GIT-VERSION-FILE
188 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
195 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test