1 # use GNU Make to run tests in parallel, and without depending on RubyGems
5 GIT_URL
= git
://git.bogomips.org
/ruby_io_splice.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
/io_splice
clean
35 $(RM
) $(setup_rb_files
) ext
/io_splice
/Makefile
37 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
38 manifest
: $(pkg_extra
)
44 for i in
$@
$(pkg_extra
); \
45 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
46 cmp
$@
+ $@ || mv
$@
+ $@
49 NEWS
: GIT-VERSION-FILE
50 $(RAKE
) -s news_rdoc
> $@
+
54 ChangeLog
: LOG_VERSION
= \
55 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
56 echo
$(GIT_VERSION
) || git describe
)
58 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
60 ChangeLog
: GIT-VERSION-FILE
61 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
63 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
66 news_atom
:= http
://bogomips.org
/ruby_io_splice
/NEWS.atom.xml
67 cgit_atom
:= http
://git.bogomips.org
/cgit
/ruby_io_splice.git
/atom
/?h
=master
68 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
69 type
="application/atom+xml"/>
71 # using rdoc 2.5.x + workaround patch here:
72 # rubyforge.org/tracker/index.php?func=detail&aid=28230&group_id=627&atid=2472
73 doc
: .document NEWS ChangeLog
74 rdoc
-a
-t
"$(shell sed -ne '1s/^= //p' README)"
75 install -m644 COPYING doc
/COPYING
76 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
77 cd doc
&& for i in
$(base_bins
); do \
78 html
=$$(echo
$$i | sed
's/\.rb/_rb/')_1.html
; \
79 sed
-e
'/"documentation">/r man1/'$$i'.1.html' \
80 < $$html > tmp
&& mv tmp
$$html; done
82 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
85 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
86 doc
/NEWS.html doc
/README.html
87 $(RAKE
) -s news_atom
> doc
/NEWS.atom.xml
88 cd doc
&& ln README.html tmp
&& mv tmp index.html
91 @awk
'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
93 # publishes docs to http://bogomips.org/ruby_io_splice/,
96 $(RM
) -r doc ChangeLog NEWS
97 $(MAKE
) doc LOG_VERSION
=$(shell git tag
-l | tail
-1)
98 awk
'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' \
100 find doc
/images doc
/js
-type f | \
101 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:01' doc
/rdoc.css
103 chmod
644 $$(find doc
-type f
)
104 $(RSYNC
) -av doc
/ bogomips.org
:/srv
/bogomips
/ruby_io_splice
/
105 git ls-files | xargs touch
107 # Create gzip variants of the same timestamp as the original so nginx
108 # "gzip_static on" can serve the gzipped versions directly.
109 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
111 touch doc
/NEWS.atom.xml
-d
"$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
112 for i in
$(docs
); do \
113 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
117 rfpackage
:= io_splice
118 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
119 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
120 release_notes
:= release_notes-
$(VERSION
)
121 release_changes
:= release_changes-
$(VERSION
)
123 release-notes
: $(release_notes
)
124 release-changes
: $(release_changes
)
126 $(RAKE
) -s release_changes
> $@
+
127 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
129 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
130 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
132 # ensures we're actually on the tagged $(VERSION), only used for release
134 test x
"$(shell umask)" = x0022
135 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
136 git diff-index
--quiet HEAD^
0
137 test `git rev-parse --verify HEAD^0` = \
138 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
141 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
142 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
146 install-gem
: $(pkggem
)
147 gem
install $(CURDIR
)/$<
149 $(pkggem
): manifest fix-perms
150 gem build
$(rfpackage
).gemspec
154 $(pkgtgz
): distdir
= $(basename $@
)
155 $(pkgtgz
): HEAD
= v
$(VERSION
)
156 $(pkgtgz
): manifest fix-perms
157 @
test -n
"$(distdir)"
160 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
161 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
164 package
: $(pkgtgz
) $(pkggem
)
166 test-release
: verify package
$(release_notes
) $(release_changes
)
167 release
: verify package
$(release_notes
) $(release_changes
)
168 # make tgz release on RubyForge
169 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
170 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
171 # push gem to Gemcutter
173 # in case of gem downloads from RubyForge releases page
174 -rubyforge add_file \
175 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
177 gem install-gem
: GIT-VERSION-FILE
178 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
181 ext
:= ext
/io_splice
/io_splice_ext.
$(DLEXT
)
182 ext
/io_splice
/Makefile
: ext
/io_splice
/extconf.rb
183 cd
$(@D
) && $(RUBY
) extconf.rb
184 $(ext
): $(wildcard $(addprefix ext
/io_splice
/,*.c
*.h
)) ext
/io_splice
/Makefile
192 $(RUBY
) -I lib
:ext
/io_splice
test/test_io_splice.rb
194 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test