1 # use GNU Make to run tests in parallel, and without depending on RubyGems
6 GIT_URL
= git
://git.bogomips.org
/ruby-tdb.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')
28 setup_rb_files
:= .config InstalledFiles
29 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
32 -$(MAKE
) -C ext
/tdb
clean
33 $(RM
) $(setup_rb_files
) ext
/tdb
/Makefile
35 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
36 manifest
: $(pkg_extra
)
42 for i in
$@
$(pkg_extra
) $(man1_paths
); \
43 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
44 cmp
$@
+ $@ || mv
$@
+ $@
47 NEWS
: GIT-VERSION-FILE
48 $(RAKE
) -s news_rdoc
> $@
+
52 @awk
'BEGIN{RS="=== ";ORS=""}NR==2{sub(/\n$$/,"");print RS""$$0 }' $<
55 ChangeLog
: LOG_VERSION
= \
56 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
57 echo
$(GIT_VERSION
) || git describe
)
59 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
61 ChangeLog
: GIT-VERSION-FILE
62 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
64 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
67 news_atom
:= http
://bogomips.org
/ruby-tdb
/NEWS.atom.xml
68 cgit_atom
:= http
://git.bogomips.org
/cgit
/ruby-tdb.git
/atom
/?h
=master
69 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
70 type
="application/atom+xml"/>
73 doc
: .document NEWS ChangeLog
74 rdoc
-t
"$(shell sed -ne '1s/^= //p' README)"
75 install -m644 COPYING doc
/COPYING
76 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
78 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
81 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
82 doc
/NEWS.html doc
/README.html
83 $(RAKE
) -s news_atom
> doc
/NEWS.atom.xml
84 cd doc
&& ln README.html tmp
&& mv tmp index.html
89 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
90 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
91 release_notes
:= release_notes-
$(VERSION
)
92 release_changes
:= release_changes-
$(VERSION
)
94 release-notes
: $(release_notes
)
95 release-changes
: $(release_changes
)
97 $(RAKE
) -s release_changes
> $@
+
98 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
100 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
101 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
103 # ensures we're actually on the tagged $(VERSION), only used for release
105 test x
"$(shell umask)" = x0022
106 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
107 git diff-index
--quiet HEAD^
0
108 test `git rev-parse --verify HEAD^0` = \
109 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
112 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
113 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
117 install-gem
: $(pkggem
)
118 gem
install $(CURDIR
)/$<
120 $(pkggem
): manifest fix-perms
121 gem build
$(rfpackage
).gemspec
125 $(pkgtgz
): distdir
= $(basename $@
)
126 $(pkgtgz
): HEAD
= v
$(VERSION
)
127 $(pkgtgz
): manifest fix-perms
128 @
test -n
"$(distdir)"
131 tar cf
- `cat .manifest` |
(cd
$(distdir
) && tar xf
-)
132 cd pkg
&& tar cf
- $(basename $(@F
)) | gzip
-9 > $(@F
)+
135 package
: $(pkgtgz
) $(pkggem
)
137 test-release
: verify package
$(release_notes
) $(release_changes
)
138 release
: verify package
$(release_notes
) $(release_changes
)
139 # make tgz release on RubyForge
140 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
141 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
142 # push gem to RubyGems.org
144 # in case of gem downloads from RubyForge releases page
145 -rubyforge add_file \
146 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
147 $(RAKE
) raa_update VERSION
=$(VERSION
)
149 gem install-gem
: GIT-VERSION-FILE
150 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
153 ext
:= ext
/tdb
/tdb_ext.
$(DLEXT
)
154 ext
/tdb
/Makefile
: ext
/tdb
/extconf.rb
155 cd
$(@D
) && $(RUBY
) extconf.rb
$(EXTCONF_ARGS
)
157 $(ext
): $(wildcard ext
/tdb
/*.
[ch
] ext
/tdb
/*/*.h
) ext
/tdb
/Makefile
163 test_units
:= $(wildcard test/test_
*.rb
)
165 test-unit
: $(test_units
)
167 $(RUBY
) -I lib
:ext
/tdb
$@
169 # this requires GNU coreutils variants
172 $(RM
) -r doc ChangeLog NEWS
173 $(MAKE
) doc LOG_VERSION
=$(shell git tag
-l | tail
-1)
174 $(MAKE
) -s latest
> doc
/LATEST
175 find doc
/images doc
/js
-type f | \
176 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:00' doc
/rdoc.css
178 chmod
644 $$(find doc
-type f
)
179 $(RSYNC
) -av doc
/ bogomips.org
:/srv
/bogomips
/ruby-tdb
/
180 git ls-files | xargs touch
182 # Create gzip variants of the same timestamp as the original so nginx
183 # "gzip_static on" can serve the gzipped versions directly.
184 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
186 touch doc
/NEWS.atom.xml
-d
"$$(awk 'NR==1{print $$4,$$5,$$6}' NEWS)"
187 for i in
$(docs
); do \
188 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
190 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test $(test_units
)