1 # use GNU Make to run tests in parallel, and without depending on RubyGems
6 GIT_URL
= git
://git.bogomips.org
/raindrops.git
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')
23 cp
-p bin
/* .install-tmp
26 mv .install-tmp
/* bin
/
30 setup_rb_files
:= .config InstalledFiles
31 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
34 -$(MAKE
) -C ext
/raindrops
clean
35 $(RM
) $(setup_rb_files
) ext
/raindrops
/Makefile
37 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
38 manifest
: $(pkg_extra
)
44 for i in
$@
$(pkg_extra
) $(man1_paths
); \
45 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
46 cmp
$@
+ $@ || mv
$@
+ $@
49 NEWS
: GIT-VERSION-FILE
50 $(RAKE
) -s news_rdoc
> $@
+
54 @awk
'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
57 ChangeLog
: LOG_VERSION
= \
58 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
59 echo
$(GIT_VERSION
) || git describe
)
61 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
63 ChangeLog
: GIT-VERSION-FILE
64 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
66 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
69 news_atom
:= http
://raindrops.bogomips.org
/NEWS.atom.xml
70 cgit_atom
:= http
://git.bogomips.org
/cgit
/raindrops.git
/atom
/?h
=master
71 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
72 type
="application/atom+xml"/>
75 doc
: .document NEWS ChangeLog
76 for i in
$(man1_bins
); do
> $$i; done
77 rdoc
-a
-t
"$(shell sed -ne '1s/^= //p' README)"
78 install -m644 COPYING doc
/COPYING
79 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
80 cd doc
&& for i in
$(base_bins
); do \
81 html
=$$(echo
$$i | sed
's/\.rb/_rb/')_1.html
; \
82 sed
-e
'/"documentation">/r man1/'$$i'.1.html' \
83 < $$html > tmp
&& mv tmp
$$html; done
85 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
88 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
89 doc
/NEWS.html doc
/README.html
90 $(RAKE
) -s news_atom
> doc
/NEWS.atom.xml
91 cd doc
&& ln README.html tmp
&& mv tmp index.html
96 rfpackage
:= raindrops
97 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
98 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
99 release_notes
:= release_notes-
$(VERSION
)
100 release_changes
:= release_changes-
$(VERSION
)
102 release-notes
: $(release_notes
)
103 release-changes
: $(release_changes
)
105 $(RAKE
) -s release_changes
> $@
+
106 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
108 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
109 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
111 # ensures we're actually on the tagged $(VERSION), only used for release
113 test x
"$(shell umask)" = x0022
114 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
115 git diff-index
--quiet HEAD^
0
116 test `git rev-parse --verify HEAD^0` = \
117 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
120 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
121 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
125 install-gem
: $(pkggem
)
126 gem
install $(CURDIR
)/$<
128 $(pkggem
): manifest fix-perms
129 gem build
$(rfpackage
).gemspec
133 $(pkgtgz
): distdir
= $(basename $@
)
134 $(pkgtgz
): HEAD
= v
$(VERSION
)
135 $(pkgtgz
): manifest fix-perms
136 @
test -n
"$(distdir)"
139 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
140 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
143 package
: $(pkgtgz
) $(pkggem
)
145 test-release
: verify package
$(release_notes
) $(release_changes
)
146 release
: verify package
$(release_notes
) $(release_changes
)
147 # make tgz release on RubyForge
148 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
149 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
150 # push gem to Gemcutter
152 # in case of gem downloads from RubyForge releases page
153 -rubyforge add_file \
154 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
156 gem install-gem
: GIT-VERSION-FILE
157 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
160 ext
:= ext
/raindrops
/raindrops_ext.
$(DLEXT
)
161 ext
/raindrops
/Makefile
: ext
/raindrops
/extconf.rb
162 cd
$(@D
) && $(RUBY
) extconf.rb
163 $(ext
): $(wildcard $(addprefix ext
/raindrops
/,*.c
*.h
)) ext
/raindrops
/Makefile
168 export STRESS BENCHMARK
170 test_units
:= $(wildcard test/test_
*.rb
)
172 test-unit
: $(test_units
)
174 $(RUBY
) -I lib
:ext
/raindrops
$@
176 # this requires GNU coreutils variants
179 $(RM
) -r doc ChangeLog NEWS
180 $(MAKE
) doc LOG_VERSION
=$(shell git tag
-l | tail
-1)
181 $(MAKE
) -s latest
> doc
/LATEST
182 find doc
/images doc
/js
-type f | \
183 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:00' doc
/rdoc.css
184 tar cf
- $$(git ls-files examples
/) |
(cd doc
&& tar xf
-)
186 chmod
644 $$(find doc
-type f
)
187 $(RSYNC
) -av doc
/ raindrops.bogomips.org
:/srv
/raindrops
/
188 git ls-files | xargs touch
190 # Create gzip variants of the same timestamp as the original so nginx
191 # "gzip_static on" can serve the gzipped versions directly.
192 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
194 touch doc
/NEWS.atom.xml
-d
"$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
195 for i in
$(docs
); do \
196 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
198 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test $(test_units
)