6 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
8 -include GIT-VERSION-FILE
10 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts RbConfig::CONFIG["DLEXT"]')
11 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
12 RUBY_ENGINE
:= $(shell $(RUBY
) -e
'puts((RUBY_ENGINE rescue "ruby"))')
15 ifeq ($(shell test -f script
/isolate_for_tests
&& echo t
),t
)
16 isolate_libs
:= tmp
/isolate
/$(RUBY_ENGINE
)-$(RUBY_VERSION
)/isolate.mk
17 $(isolate_libs
): script
/isolate_for_tests
18 @
$(RUBY
) script
/isolate_for_tests
19 -include $(isolate_libs
)
20 lib
:= $(lib
):$(ISOLATE_LIBS
)
23 ext
:= $(firstword $(wildcard ext
/*))
25 ext_pfx
:= tmp
/ext
/$(RUBY_ENGINE
)-$(RUBY_VERSION
)
26 ext_h
:= $(wildcard $(ext
)/*/*.h
$(ext
)/*.h
)
27 ext_src
:= $(wildcard $(ext
)/*.c
$(ext_h
))
28 ext_pfx_src
:= $(addprefix $(ext_pfx
)/,$(ext_src
))
29 ext_d
:= $(ext_pfx
)/$(ext
)/.d
30 $(ext
)/extconf.rb
: $(wildcard $(ext
)/*.h
)
35 $(ext_pfx
)/$(ext
)/%: $(ext
)/% $(ext_d
)
37 $(ext_pfx
)/$(ext
)/Makefile
: $(ext
)/extconf.rb
$(ext_d
) $(ext_h
)
39 cd
$(@D
) && $(RUBY
) $(CURDIR
)/$(ext
)/extconf.rb
40 ext_sfx
:= _ext.
$(DLEXT
)
41 ext_dl
:= $(ext_pfx
)/$(ext
)/$(notdir $(ext
)_ext.
$(DLEXT
))
42 $(ext_dl
): $(ext_src
) $(ext_pfx_src
) $(ext_pfx
)/$(ext
)/Makefile
45 lib
:= $(lib
):$(ext_pfx
)/$(ext
)
49 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog LATEST
50 ChangeLog
: GIT-VERSION-FILE .wrongdoc.yml
58 (git ls-files
&& for i in
$@
$(pkg_extra
); do echo
$$i; done
) | \
60 cmp
$@
+ $@ || mv
$@
+ $@
63 doc
:: .document .wrongdoc.yml
64 -find lib
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
65 -find ext
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
68 install -m644 COPYING doc
/COPYING
69 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
72 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
73 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
74 release_notes
:= release_notes-
$(VERSION
)
75 release_changes
:= release_changes-
$(VERSION
)
77 release-notes
: $(release_notes
)
78 release-changes
: $(release_changes
)
80 $(WRONGDOC
) release_changes
> $@
+
81 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
83 $(WRONGDOC
) release_notes
> $@
+
84 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
86 # ensures we're actually on the tagged $(VERSION), only used for release
88 test x
"$(shell umask)" = x0022
89 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
90 git diff-index
--quiet HEAD^
0
91 test $$(git rev-parse
--verify HEAD^
0) = \
92 $$(git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{})
95 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
96 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
100 install-gem
: $(pkggem
)
101 gem
install $(CURDIR
)/$<
103 $(pkggem
): manifest fix-perms
104 gem build
$(rfpackage
).gemspec
108 $(pkgtgz
): distdir
= $(basename $@
)
109 $(pkgtgz
): HEAD
= v
$(VERSION
)
110 $(pkgtgz
): manifest fix-perms
111 @
test -n
"$(distdir)"
114 tar cf
- $$(cat .manifest
) |
(cd
$(distdir
) && tar xf
-)
115 cd pkg
&& tar cf
- $(basename $(@F
)) | gzip
-9 > $(@F
)+
118 package
: $(pkgtgz
) $(pkggem
)
120 test-release
:: verify package
$(release_notes
) $(release_changes
)
121 # make tgz release on RubyForge
122 @echo rubyforge add_release
-f \
123 -n
$(release_notes
) -a
$(release_changes
) \
124 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
125 @echo gem push
$(pkggem
)
126 @echo rubyforge add_file \
127 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
128 release
:: verify package
$(release_notes
) $(release_changes
)
129 # make tgz release on RubyForge
130 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
131 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
132 # push gem to RubyGems.org
134 # in case of gem downloads from RubyForge releases page
136 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
138 gem install-gem
: GIT-VERSION-FILE
139 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
143 test_units
:= $(wildcard test/test_
*.rb
)
145 test-unit
: $(test_units
)
149 # this requires GNU coreutils variants
150 ifneq ($(RSYNC_DEST
),)
154 find doc
/images
-type f | \
155 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:06' doc
/rdoc.css
157 $(RSYNC
) -av doc
/ $(RSYNC_DEST
)/
158 git ls-files | xargs touch
161 # Create gzip variants of the same timestamp as the original so nginx
162 # "gzip_static on" can serve the gzipped versions directly.
163 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
165 for i in
$(docs
); do \
166 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
168 .PHONY
: all .FORCE-GIT-VERSION-FILE doc
test $(test_units
) manifest