1 # use GNU Make to run tests in parallel, and without depending on RubyGems
5 GIT_URL
= git
://git.bogomips.org
/sunshowers.git
7 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
9 -include GIT-VERSION-FILE
11 ifeq ($(DLEXT
),) # "so" for Linux
12 DLEXT
:= $(shell $(RUBY
) -rrbconfig
-e
'puts Config::CONFIG["DLEXT"]')
14 ifeq ($(RUBY_VERSION
),)
15 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
22 cp
-p bin
/* .install-tmp
25 mv .install-tmp
/* bin
/
29 setup_rb_files
:= .config InstalledFiles
30 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
33 -$(MAKE
) -C
$(ext
) clean
34 $(RM
) $(setup_rb_files
) $(t_log
)
36 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
37 manifest
: $(pkg_extra
)
43 for i in
$@
$(pkg_extra
); \
44 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
45 cmp
$@
+ $@ || mv
$@
+ $@
48 NEWS
: GIT-VERSION-FILE
49 $(RAKE
) -s news_rdoc
> $@
+
53 ChangeLog
: LOG_VERSION
= \
54 $(shell git rev-parse
-q
"$(GIT_VERSION)" >/dev
/null
2>&1 && \
55 echo
$(GIT_VERSION
) || git describe
)
57 ChangeLog
: log_range
= v
$(SINCE
)..
$(LOG_VERSION
)
59 ChangeLog
: GIT-VERSION-FILE
60 @echo
"ChangeLog from $(GIT_URL) ($(log_range))" > $@
+
62 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
65 news_atom
:= http
://rainbows.rubyforge.org
/sunshowers
/NEWS.atom.xml
66 cgit_atom
:= http
://git.bogomips.org
/cgit
/sunshowers.git
/atom
/?h
=master
67 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
68 type
="application/atom+xml"/>
71 doc
: .document NEWS ChangeLog
72 rdoc
-Na
-t
"$(shell sed -ne '1s/^= //p' README)"
73 install -m644 COPYING doc
/COPYING
74 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
76 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
79 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
80 doc
/NEWS.html doc
/README.html
81 $(RAKE
) -s news_atom
> doc
/NEWS.atom.xml
82 cd doc
&& ln README.html tmp
&& mv tmp index.html
86 rfpackage
:= sunshowers
87 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
88 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
89 release_notes
:= release_notes-
$(VERSION
)
90 release_changes
:= release_changes-
$(VERSION
)
92 release-notes
: $(release_notes
)
93 release-changes
: $(release_changes
)
95 $(RAKE
) -s release_changes
> $@
+
96 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
98 GIT_URL
=$(GIT_URL
) $(RAKE
) -s release_notes
> $@
+
99 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
101 # ensures we're actually on the tagged $(VERSION), only used for release
103 test x
"$(shell umask)" = x0022
104 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
105 git diff-index
--quiet HEAD^
0
106 test `git rev-parse --verify HEAD^0` = \
107 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
110 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
111 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
115 install-gem
: $(pkggem
)
116 gem
install $(CURDIR
)/$<
118 $(pkggem
): manifest fix-perms
119 gem build
$(rfpackage
).gemspec
123 $(pkgtgz
): distdir
= $(basename $@
)
124 $(pkgtgz
): HEAD
= v
$(VERSION
)
125 $(pkgtgz
): manifest fix-perms
126 @
test -n
"$(distdir)"
129 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
130 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
133 package
: $(pkgtgz
) $(pkggem
)
135 release
: verify package
$(release_notes
) $(release_changes
)
136 # make tgz release on RubyForge
137 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
138 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
139 # push gem to Gemcutter
141 # in case of gem downloads from RubyForge releases page
142 -rubyforge add_file \
143 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
145 gem install-gem
: GIT-VERSION-FILE
146 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
150 test: test-unit test-integration
151 TEST_UNIT
:= $(wildcard test/test_
*.rb
)
156 test-unit
: $(TEST_UNIT
)
161 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test $(TEST_UNIT
)