1 # use GNU Make to run tests in parallel, and without depending on RubyGems
6 GIT_URL
= git
://git.bogomips.org
/ruby-tdb.git
7 CGIT_URL
= http
://git.bogomips.org
/cgit
/ruby-tdb.git
9 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
11 -include GIT-VERSION-FILE
13 ifeq ($(DLEXT
),) # "so" for Linux
14 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts Config::CONFIG["DLEXT"]')
16 ifeq ($(RUBY_VERSION
),)
17 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
29 setup_rb_files
:= .config InstalledFiles
30 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
33 -$(MAKE
) -C ext
/tdb
clean
34 $(RM
) $(setup_rb_files
) ext
/tdb
/Makefile
36 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
37 manifest
: $(pkg_extra
)
43 for i in
$@
$(pkg_extra
) $(man1_paths
); \
44 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
45 cmp
$@
+ $@ || mv
$@
+ $@
48 NEWS
: GIT-VERSION-FILE
49 $(RAKE
) -s news_rdoc
> $@
+
53 @awk
'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
56 ChangeLog
: LOG_VERSION
= \
57 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
58 echo
$(GIT_VERSION
) || git describe
)
60 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
62 ChangeLog
: GIT-VERSION-FILE
63 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
65 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
68 news_atom
:= http
://bogomips.org
/ruby-tdb
/NEWS.atom.xml
69 cgit_atom
:= $(CGIT_URL
)/atom
/?h
=master
70 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
71 type
="application/atom+xml"/>
74 doc
: .document NEWS ChangeLog
75 rdoc
--webcvs
=$(CGIT_URL
)/tree
/%s \
76 -t
"$(shell sed -ne '1s/^= //p' README)"
77 install -m644 COPYING doc
/COPYING
78 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
80 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
83 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
84 doc
/NEWS.html doc
/README.html
85 $(RAKE
) -s news_atom
> doc
/NEWS.atom.xml
86 cd doc
&& ln README.html tmp
&& mv tmp index.html
91 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
92 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
93 release_notes
:= release_notes-
$(VERSION
)
94 release_changes
:= release_changes-
$(VERSION
)
96 release-notes
: $(release_notes
)
97 release-changes
: $(release_changes
)
99 $(RAKE
) -s release_changes
> $@
+
100 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
102 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
103 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
105 # ensures we're actually on the tagged $(VERSION), only used for release
107 test x
"$(shell umask)" = x0022
108 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
109 git diff-index
--quiet HEAD^
0
110 test `git rev-parse --verify HEAD^0` = \
111 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
114 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
115 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
119 install-gem
: $(pkggem
)
120 gem
install $(CURDIR
)/$<
122 $(pkggem
): manifest fix-perms
123 gem build
$(rfpackage
).gemspec
127 $(pkgtgz
): distdir
= $(basename $@
)
128 $(pkgtgz
): HEAD
= v
$(VERSION
)
129 $(pkgtgz
): manifest fix-perms
130 @
test -n
"$(distdir)"
133 tar cf
- `cat .manifest` |
(cd
$(distdir
) && tar xf
-)
134 cd pkg
&& tar cf
- $(basename $(@F
)) | gzip
-9 > $(@F
)+
137 package
: $(pkgtgz
) $(pkggem
)
139 test-release
: verify package
$(release_notes
) $(release_changes
)
140 release
: verify package
$(release_notes
) $(release_changes
)
141 # make tgz release on RubyForge
142 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
143 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
144 # push gem to RubyGems.org
146 # in case of gem downloads from RubyForge releases page
147 -rubyforge add_file \
148 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
149 $(RAKE
) raa_update VERSION
=$(VERSION
)
151 gem install-gem
: GIT-VERSION-FILE
152 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
155 ext
:= ext
/tdb
/tdb_ext.
$(DLEXT
)
156 ext
/tdb
/Makefile
: ext
/tdb
/extconf.rb
157 cd
$(@D
) && $(RUBY
) extconf.rb
$(EXTCONF_ARGS
)
159 $(ext
): $(wildcard ext
/tdb
/*.
[ch
] ext
/tdb
/*/*.h
) ext
/tdb
/Makefile
165 test_units
:= $(wildcard test/test_
*.rb
)
167 test-unit
: $(test_units
)
169 $(RUBY
) -I lib
:ext
/tdb
$@
171 # this requires GNU coreutils variants
174 $(RM
) -r doc ChangeLog NEWS
175 $(MAKE
) doc LOG_VERSION
=$(shell git tag
-l | tail
-1)
176 $(MAKE
) -s latest
> doc
/LATEST
177 find doc
/images doc
/js
-type f | \
178 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:00' doc
/rdoc.css
180 chmod
644 $$(find doc
-type f
)
181 $(RSYNC
) -av doc
/ bogomips.org
:/srv
/bogomips
/ruby-tdb
/
182 git ls-files | xargs touch
184 # Create gzip variants of the same timestamp as the original so nginx
185 # "gzip_static on" can serve the gzipped versions directly.
186 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
188 touch doc
/NEWS.atom.xml
-d
"$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
189 for i in
$(docs
); do \
190 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
192 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test $(test_units
)