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 ext
:= $(firstword $(wildcard ext
/*))
18 ext_pfx
:= tmp
/ext
/$(RUBY_ENGINE
)-$(RUBY_VERSION
)
19 ext_h
:= $(wildcard $(ext
)/*/*.h
$(ext
)/*.h
)
20 ext_src
:= $(wildcard $(ext
)/*.c
$(ext_h
))
21 ext_pfx_src
:= $(addprefix $(ext_pfx
)/,$(ext_src
))
22 ext_d
:= $(ext_pfx
)/$(ext
)/.d
23 $(ext
)/extconf.rb
: $(wildcard $(ext
)/*.h
)
28 $(ext_pfx
)/$(ext
)/%: $(ext
)/% $(ext_d
)
30 $(ext_pfx
)/$(ext
)/Makefile
: $(ext
)/extconf.rb
$(ext_d
) $(ext_h
)
32 cd
$(@D
) && $(RUBY
) $(CURDIR
)/$(ext
)/extconf.rb
$(EXTCONF_ARGS
)
33 ext_sfx
:= _ext.
$(DLEXT
)
34 ext_dl
:= $(ext_pfx
)/$(ext
)/$(notdir $(ext
)_ext.
$(DLEXT
))
35 $(ext_dl
): $(ext_src
) $(ext_pfx_src
) $(ext_pfx
)/$(ext
)/Makefile
38 lib
:= $(lib
):$(ext_pfx
)/$(ext
)
44 pkg_extra
+= GIT-VERSION-FILE NEWS LATEST
45 NEWS
: GIT-VERSION-FILE .olddoc.yml
53 .manifest
: $(pkg_extra
)
54 (git ls-files
&& for i in
$@
$(pkg_extra
); do echo
$$i; done
) | \
56 cmp
$@
+ $@ || mv
$@
+ $@
59 doc
:: .document .olddoc.yml
$(pkg_extra
) $(PLACEHOLDERS
)
60 -find lib
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
61 -find ext
-type f
-name
'*.rbc' -exec
rm -f
'{}' ';'
65 install -m644 COPYING doc
/COPYING
66 install -m644 NEWS doc
/NEWS
67 install -m644 NEWS.atom.xml doc
/NEWS.atom.xml
68 install -m644
$(shell LC_ALL
=C grep
'^[A-Z]' .document
) doc
/
71 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
72 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
74 # ensures we're actually on the tagged $(VERSION), only used for release
76 test x
"$(shell umask)" = x0022
77 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
78 git diff-index
--quiet HEAD^
0
79 test $$(git rev-parse
--verify HEAD^
0) = \
80 $$(git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{})
83 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
84 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
88 install-gem
: $(pkggem
)
89 gem
install $(CURDIR
)/$<
91 $(pkggem
): manifest fix-perms
92 gem build
$(rfpackage
).gemspec
96 $(pkgtgz
): distdir
= $(basename $@
)
97 $(pkgtgz
): HEAD
= v
$(VERSION
)
98 $(pkgtgz
): manifest fix-perms
102 tar cf
- $$(cat .manifest
) |
(cd
$(distdir
) && tar xf
-)
103 cd pkg
&& tar cf
- $(basename $(@F
)) | gzip
-9 > $(@F
)+
106 package
: $(pkgtgz
) $(pkggem
)
108 release
:: verify package
109 # push gem to RubyGems.org
112 gem install-gem
: GIT-VERSION-FILE
113 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
117 test_units
:= $(wildcard test/test_
*.rb
)
120 test-unit
: $(test_units
)
122 $(RUBY
) -I
$(lib
) $@
$(RUBY_TEST_OPTS
)
124 # this requires GNU coreutils variants
125 ifneq ($(RSYNC_DEST
),)
130 $(RSYNC
) -av doc
/ $(RSYNC_DEST
)/
131 git ls-files | xargs touch
134 # Create gzip variants of the same timestamp as the original so nginx
135 # "gzip_static on" can serve the gzipped versions directly.
136 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.gz$$')
138 for i in
$(docs
); do \
139 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
141 @
(for i in
$$(git ls-files
'*.rb'| grep
-v
'^setup\.rb$$'); \
142 do
$(RUBY
) -d
-W2
-c
$$i; done
) | grep
-v
'^Syntax OK$$' ||
:
144 ifneq ($(PLACEHOLDERS
),)
146 echo olddoc_placeholder
> $@
149 .PHONY
: all .FORCE-GIT-VERSION-FILE doc
check test $(test_units
) manifest
150 .PHONY
: check-warnings