1 # use GNU Make to run tests in parallel, and without depending on Rubygems
5 GIT_URL
= git
://git.bogomips.org
/rainbows.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')
19 bins
:= $(addprefix bin
/, $(base_bins
))
20 man1_bins
:= $(addsuffix .1, $(base_bins
))
21 man1_paths
:= $(addprefix man
/man1
/, $(man1_bins
))
27 cp
-p bin
/* .install-tmp
30 mv .install-tmp
/* bin
/
34 setup_rb_files
:= .config InstalledFiles
35 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
38 -$(MAKE
) -C
$(ext
) clean
39 -$(MAKE
) -C Documentation
clean
40 $(RM
) $(setup_rb_files
) $(t_log
)
43 $(MAKE
) -C Documentation install-man
45 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog
46 manifest
: $(pkg_extra
) man
52 for i in
$@
$(pkg_extra
) $(man1_paths
); \
53 do echo
$$i; done
) | LC_ALL
=C
sort > $@
+
54 cmp
$@
+ $@ || mv
$@
+ $@
57 NEWS
: GIT-VERSION-FILE
58 $(rake
) -s news_rdoc
> $@
+
62 ChangeLog
: log_range
= $(shell test -n
"$(SINCE)" && echo v
$(SINCE
)..
)
63 ChangeLog
: GIT-VERSION-FILE
64 @echo
"ChangeLog from $(GIT_URL) ($(SINCE)..$(GIT_VERSION))" > $@
+
66 git log
$(log_range
) | sed
-e
's/^/ /' >> $@
+
69 news_atom
:= http
://rainbows.rubyforge.org
/NEWS.atom.xml
70 cgit_atom
:= http
://git.bogomips.org
/cgit
/rainbows.git
/atom
/?h
=master
71 atom
= <link rel
="alternate" title
="Atom feed" href
="$(1)" \
72 type
="application/atom+xml"/>
75 doc
: .document NEWS ChangeLog
76 for i in
$(man1_bins
); do
> $$i; done
77 rdoc
-Na
-t
"$(shell sed -ne '1s/^= //p' README)"
78 install -m644 COPYING doc
/COPYING
79 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
80 $(MAKE
) -C Documentation install-html install-man
81 install -m644
$(man1_paths
) doc
/
82 cd doc
&& for i in
$(base_bins
); do \
83 sed
-e
'/"documentation">/r man1/'$$i'.1.html' \
84 < $${i}_1.html
> tmp
&& mv tmp
$${i}_1.html
; done
86 '$$_.gsub!("</title>",%q{\&$(call atom,$(cgit_atom))})' \
89 '$$_.gsub!("</title>",%q{\&$(call atom,$(news_atom))})' \
90 doc
/NEWS.html doc
/README.html
91 $(rake
) -s news_atom
> doc
/NEWS.atom.xml
92 cd doc
&& ln README.html tmp
&& mv tmp index.html
98 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
99 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
100 release_notes
:= release_notes-
$(VERSION
)
101 release_changes
:= release_changes-
$(VERSION
)
103 release-notes
: $(release_notes
)
104 release-changes
: $(release_changes
)
106 $(rake
) -s release_changes
> $@
+
107 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
109 GIT_URL
=$(GIT_URL
) $(rake
) -s release_notes
> $@
+
110 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
112 # ensures we're actually on the tagged $(VERSION), only used for release
114 test x
"$(shell umask)" = x0022
115 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
116 git diff-index
--quiet HEAD^
0
117 test `git rev-parse --verify HEAD^0` = \
118 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
121 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
122 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
126 install-gem
: $(pkggem
)
127 gem
install $(CURDIR
)/$<
129 $(pkggem
): manifest fix-perms
130 gem build
$(rfpackage
).gemspec
134 $(pkgtgz
): distdir
= $(basename $@
)
135 $(pkgtgz
): HEAD
= v
$(VERSION
)
136 $(pkgtgz
): manifest fix-perms
137 @
test -n
"$(distdir)"
140 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
141 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
144 package
: $(pkgtgz
) $(pkggem
)
146 release
: verify package
$(release_notes
) $(release_changes
)
147 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
148 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
150 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
152 gem install-gem
: GIT-VERSION-FILE
153 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
160 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test