1 # use GNU Make to run tests in parallel, and without depending on RubyGems
5 GIT_URL
= git
://git.bogomips.org
/rainbows.git
7 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
9 -include GIT-VERSION-FILE
11 ifeq ($(DLEXT
),) # "so" for Linux
12 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts Config::CONFIG["DLEXT"]')
14 ifeq ($(RUBY_VERSION
),)
15 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
19 bins
:= $(addprefix bin
/, $(base_bins
))
20 man1_bins
:= $(addsuffix .1, $(base_bins
))
21 man1_paths
:= $(addprefix man
/man1
/, $(man1_bins
))
27 cp
-p bin
/* .install-tmp
30 mv .install-tmp
/* bin
/
34 setup_rb_files
:= .config InstalledFiles
35 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
38 -$(MAKE
) -C
$(ext
) clean
39 -$(MAKE
) -C Documentation
clean
40 $(RM
) $(setup_rb_files
) $(t_log
)
43 $(MAKE
) -C Documentation install-man
45 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
46 manifest
: $(pkg_extra
) man
52 for i in
$@
$(pkg_extra
) $(man1_paths
); \
53 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
54 cmp
$@
+ $@ || mv
$@
+ $@
57 NEWS
: GIT-VERSION-FILE
58 $(RAKE
) -s news_rdoc
> $@
+
62 ChangeLog
: LOG_VERSION
= \
63 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
64 echo
$(GIT_VERSION
) || git describe
)
65 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
66 ChangeLog
: GIT-VERSION-FILE
67 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
69 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
72 news_atom
:= http
://rainbows.rubyforge.org
/NEWS.atom.xml
73 cgit_atom
:= http
://git.bogomips.org
/cgit
/rainbows.git
/atom
/?h
=master
74 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
75 type
="application/atom+xml"/>
78 doc
: .document NEWS ChangeLog
79 for i in
$(man1_bins
); do
> $$i; done
80 find bin lib
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
81 rdoc
-Na
-t
"$(shell sed -ne '1s/^= //p' README)"
82 install -m644 COPYING doc
/COPYING
83 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
84 $(MAKE
) -C Documentation install-html install-man
85 install -m644
$(man1_paths
) doc
/
86 cd doc
&& for i in
$(base_bins
); do \
87 sed
-e
'/"documentation">/r man1/'$$i'.1.html' \
88 < $${i}_1.html
> tmp
&& mv tmp
$${i}_1.html
; done
90 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
93 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
94 doc
/NEWS.html doc
/README.html
95 $(RAKE
) -s news_atom
> doc
/NEWS.atom.xml
96 cd doc
&& ln README.html tmp
&& mv tmp index.html
97 $(MAKE
) -C Documentation comparison.html
99 '$$_.gsub!(/INCLUDE/){File.read("Documentation/comparison.html")}' \
101 cat Documentation
/comparison.css
>> doc
/rdoc.css
105 rfproject
:= rainbows
106 rfpackage
:= rainbows
107 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
108 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
109 release_notes
:= release_notes-
$(VERSION
)
110 release_changes
:= release_changes-
$(VERSION
)
112 release-notes
: $(release_notes
)
113 release-changes
: $(release_changes
)
115 $(RAKE
) -s release_changes
> $@
+
116 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
118 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
119 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
121 # ensures we're actually on the tagged $(VERSION), only used for release
123 test x
"$(shell umask)" = x0022
124 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
125 git diff-index
--quiet HEAD^
0
126 test `git rev-parse --verify HEAD^0` = \
127 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
130 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
131 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
135 install-gem
: $(pkggem
)
136 gem
install $(CURDIR
)/$<
138 $(pkggem
): manifest fix-perms
139 gem build
$(rfpackage
).gemspec
143 $(pkgtgz
): distdir
= $(basename $@
)
144 $(pkgtgz
): HEAD
= v
$(VERSION
)
145 $(pkgtgz
): manifest fix-perms
146 @
test -n
"$(distdir)"
149 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
150 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
153 package
: $(pkgtgz
) $(pkggem
)
155 release
: verify package
$(release_notes
) $(release_changes
)
156 # make tgz release on RubyForge
157 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
158 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
159 # push gem to Gemcutter
161 # in case of gem downloads from RubyForge releases page
162 -rubyforge add_file \
163 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
165 gem install-gem
: GIT-VERSION-FILE
166 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
173 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test