7 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
9 -include GIT-VERSION-FILE
11 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts RbConfig::CONFIG["DLEXT"]')
12 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
13 RUBY_ENGINE
:= $(shell $(RUBY
) -e
'puts((RUBY_ENGINE rescue "ruby"))')
16 ifeq ($(shell test -f script
/isolate_for_tests
&& echo t
),t
)
17 isolate_libs
:= tmp
/isolate
/$(RUBY_ENGINE
)-$(RUBY_VERSION
)/isolate.mk
18 $(isolate_libs
): script
/isolate_for_tests
19 @
$(RUBY
) script
/isolate_for_tests
20 -include $(isolate_libs
)
21 lib
:= $(lib
):$(ISOLATE_LIBS
)
24 ext
:= $(firstword $(wildcard ext
/*))
26 ext_pfx
:= tmp
/ext
/$(RUBY_ENGINE
)-$(RUBY_VERSION
)
27 ext_h
:= $(wildcard $(ext
)/*/*.h
$(ext
)/*.h
)
28 ext_src
:= $(wildcard $(ext
)/*.c
$(ext_h
))
29 ext_pfx_src
:= $(addprefix $(ext_pfx
)/,$(ext_src
))
30 ext_d
:= $(ext_pfx
)/$(ext
)/.d
31 $(ext
)/extconf.rb
: $(wildcard $(ext
)/*.h
)
36 $(ext_pfx
)/$(ext
)/%: $(ext
)/% $(ext_d
)
38 $(ext_pfx
)/$(ext
)/Makefile
: $(ext
)/extconf.rb
$(ext_d
) $(ext_h
)
40 cd
$(@D
) && $(RUBY
) $(CURDIR
)/$(ext
)/extconf.rb
41 ext_sfx
:= _ext.
$(DLEXT
)
42 ext_dl
:= $(ext_pfx
)/$(ext
)/$(notdir $(ext
)_ext.
$(DLEXT
))
43 $(ext_dl
): $(ext_src
) $(ext_pfx_src
) $(ext_pfx
)/$(ext
)/Makefile
46 lib
:= $(lib
):$(ext_pfx
)/$(ext
)
52 pkg_extra
+= GIT-VERSION-FILE NEWS LATEST
53 NEWS
: GIT-VERSION-FILE .olddoc.yml
61 .manifest
: $(pkg_extra
)
62 (git ls-files
&& for i in
$@
$(pkg_extra
); do echo
$$i; done
) | \
64 cmp
$@
+ $@ || mv
$@
+ $@
67 doc
:: .document .olddoc.yml
$(pkg_extra
) $(PLACEHOLDERS
)
68 -find lib
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
69 -find ext
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
73 install -m644 COPYING doc
/COPYING
74 install -m644 NEWS doc
/NEWS
75 install -m644 NEWS.atom.xml doc
/NEWS.atom.xml
76 install -m644
$(shell LC_ALL
=C grep
'^[A-Z]' .document
) doc
/
79 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
80 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
82 # ensures we're actually on the tagged $(VERSION), only used for release
84 test x
"$(shell umask)" = x0022
85 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
86 git diff-index
--quiet HEAD^
0
87 test $$(git rev-parse
--verify HEAD^
0) = \
88 $$(git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{})
91 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
92 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
96 install-gem
: $(pkggem
)
97 gem
install $(CURDIR
)/$<
99 $(pkggem
): manifest fix-perms
100 gem build
$(rfpackage
).gemspec
104 $(pkgtgz
): distdir
= $(basename $@
)
105 $(pkgtgz
): HEAD
= v
$(VERSION
)
106 $(pkgtgz
): manifest fix-perms
107 @
test -n
"$(distdir)"
110 tar cf
- $$(cat .manifest
) |
(cd
$(distdir
) && tar xf
-)
111 cd pkg
&& tar cf
- $(basename $(@F
)) | gzip
-9 > $(@F
)+
114 package
: $(pkgtgz
) $(pkggem
)
116 release
:: verify package
117 # push gem to RubyGems.org
120 gem install-gem
: GIT-VERSION-FILE
121 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
125 test_units
:= $(wildcard test/test_
*.rb
)
127 test-unit
: $(test_units
)
129 $(RUBY
) -I
$(lib
) $@
$(RUBY_TEST_OPTS
)
131 # this requires GNU coreutils variants
132 ifneq ($(RSYNC_DEST
),)
137 $(RSYNC
) -av doc
/ $(RSYNC_DEST
)/
138 git ls-files | xargs touch
141 # Create gzip variants of the same timestamp as the original so nginx
142 # "gzip_static on" can serve the gzipped versions directly.
143 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.gz$$')
145 for i in
$(docs
); do \
146 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
148 @
(for i in
$$(git ls-files
'*.rb'| grep
-v
'^setup\.rb$$'); \
149 do
$(RUBY
) -d
-W2
-c
$$i; done
) | grep
-v
'^Syntax OK$$' ||
:
151 ifneq ($(PLACEHOLDERS
),)
153 echo olddoc_placeholder
> $@
156 .PHONY
: all .FORCE-GIT-VERSION-FILE doc
test $(test_units
) manifest
157 .PHONY
: check-warnings