1 # use GNU Make to run tests in parallel, and without depending on RubyGems
5 GIT_URL
= git
://git.bogomips.org
/rainbows.git
6 ISOLATE_CONFIG
= config
/isolate.rb
8 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
10 -include GIT-VERSION-FILE
12 ifeq ($(DLEXT
),) # "so" for Linux
13 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts Config::CONFIG["DLEXT"]')
15 ifeq ($(RUBY_VERSION
),)
16 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
19 # rake takes forever to start
20 isolate
: tmp
/gems
/$(RUBY_VERSION
)/.isolate
21 tmp
/gems
/$(RUBY_VERSION
)/.isolate
: $(ISOLATE_CONFIG
)
22 ISOLATE_CONFIG
=$(ISOLATE_CONFIG
) $(RAKE
) isolate
26 bins
:= $(addprefix bin
/, $(base_bins
))
27 man1_bins
:= $(addsuffix .1, $(base_bins
))
28 man1_paths
:= $(addprefix man
/man1
/, $(man1_bins
))
34 cp
-p bin
/* .install-tmp
37 mv .install-tmp
/* bin
/
41 setup_rb_files
:= .config InstalledFiles
42 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
45 -$(MAKE
) -C
$(ext
) clean
46 -$(MAKE
) -C Documentation
clean
47 $(RM
) $(setup_rb_files
) $(t_log
)
50 $(MAKE
) -C Documentation install-man
52 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
53 manifest
: $(pkg_extra
) man
59 for i in
$@
$(pkg_extra
) $(man1_paths
); \
60 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
61 cmp
$@
+ $@ || mv
$@
+ $@
64 NEWS
: GIT-VERSION-FILE
65 $(RAKE
) -s news_rdoc
> $@
+
69 ChangeLog
: LOG_VERSION
= \
70 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
71 echo
$(GIT_VERSION
) || git describe
)
72 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
73 ChangeLog
: GIT-VERSION-FILE
74 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
76 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
79 news_atom
:= http
://rainbows.rubyforge.org
/NEWS.atom.xml
80 cgit_atom
:= http
://git.bogomips.org
/cgit
/rainbows.git
/atom
/?h
=master
81 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
82 type
="application/atom+xml"/>
85 doc
: .document NEWS ChangeLog
86 for i in
$(man1_bins
); do
> $$i; done
87 find bin lib
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
88 rdoc
-Na
-t
"$(shell sed -ne '1s/^= //p' README)"
89 install -m644 COPYING doc
/COPYING
90 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
91 $(MAKE
) -C Documentation install-html install-man
92 install -m644
$(man1_paths
) doc
/
93 cd doc
&& for i in
$(base_bins
); do \
94 sed
-e
'/"documentation">/r man1/'$$i'.1.html' \
95 < $${i}_1.html
> tmp
&& mv tmp
$${i}_1.html
; done
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
112 rfproject
:= rainbows
113 rfpackage
:= rainbows
114 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
115 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
116 release_notes
:= release_notes-
$(VERSION
)
117 release_changes
:= release_changes-
$(VERSION
)
119 release-notes
: $(release_notes
)
120 release-changes
: $(release_changes
)
122 $(RAKE
) -s release_changes
> $@
+
123 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
125 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
126 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
128 # ensures we're actually on the tagged $(VERSION), only used for release
130 test x
"$(shell umask)" = x0022
131 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
132 git diff-index
--quiet HEAD^
0
133 test `git rev-parse --verify HEAD^0` = \
134 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
137 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
138 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
142 install-gem
: $(pkggem
)
143 gem
install $(CURDIR
)/$<
145 $(pkggem
): manifest fix-perms
146 gem build
$(rfpackage
).gemspec
150 $(pkgtgz
): distdir
= $(basename $@
)
151 $(pkgtgz
): HEAD
= v
$(VERSION
)
152 $(pkgtgz
): manifest fix-perms
153 @
test -n
"$(distdir)"
156 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
157 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
160 package
: $(pkgtgz
) $(pkggem
)
162 release
: verify package
$(release_notes
) $(release_changes
)
163 # make tgz release on RubyForge
164 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
165 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
166 # push gem to Gemcutter
168 # in case of gem downloads from RubyForge releases page
169 -rubyforge add_file \
170 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
172 gem install-gem
: GIT-VERSION-FILE
173 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
180 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test