1 # use GNU Make to run tests in parallel, and without depending on RubyGems
7 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
9 -include GIT-VERSION-FILE
11 ifeq ($(RUBY_VERSION
),)
12 RUBY_VERSION
:= $(shell $(RUBY
) -e
'puts RUBY_VERSION')
19 cp
-p bin
/* .install-tmp
22 mv .install-tmp
/* bin
/
26 setup_rb_files
:= .config InstalledFiles
27 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
30 $(RM
) $(setup_rb_files
)
32 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog LATEST
39 (git ls-files
&& for i in
$@
$(pkg_extra
);do echo
$$i; done
) | \
41 cmp
$@
+ $@ || mv
$@
+ $@
44 doc
: .document .wrongdoc.yml
46 install -m644 COPYING doc
/COPYING
47 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
51 rfpackage
:= metropolis
52 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
53 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
54 release_notes
:= release_notes-
$(VERSION
)
55 release_changes
:= release_changes-
$(VERSION
)
57 release-notes
: $(release_notes
)
58 release-changes
: $(release_changes
)
60 wrongdoc release_changes
> $@
+
61 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
63 wrongdoc release_notes
> $@
+
64 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
66 # ensures we're actually on the tagged $(VERSION), only used for release
68 test x
"$(shell umask)" = x0022
69 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
70 git diff-index
--quiet HEAD^
0
71 test `git rev-parse --verify HEAD^0` = \
72 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
75 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
76 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
80 install-gem
: $(pkggem
)
81 gem
install $(CURDIR
)/$<
83 $(pkggem
): manifest fix-perms
84 gem build
$(rfpackage
).gemspec
88 $(pkgtgz
): distdir
= $(basename $@
)
89 $(pkgtgz
): HEAD
= v
$(VERSION
)
90 $(pkgtgz
): manifest fix-perms
94 tar cf
- `cat .manifest` |
(cd
$(distdir
) && tar x
)
95 cd pkg
&& tar cf
- $(basename $(@F
)) | gzip
-9 > $(@F
)+
98 package
: $(pkgtgz
) $(pkggem
)
100 test-release
: verify package
$(release_notes
) $(release_changes
)
101 release
: verify package
$(release_notes
) $(release_changes
)
102 # make tgz release on RubyForge
103 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
104 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
105 # push gem to RubyGems.org
107 # in case of gem downloads from RubyForge releases page
108 -rubyforge add_file \
109 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
111 gem install-gem
: GIT-VERSION-FILE
112 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
117 test_units
:= $(wildcard test/test_
*.rb
)
119 test-unit
: $(test_units
)
123 # this requires GNU coreutils variants
128 find doc
/images
-type f | \
129 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:02' doc
/rdoc.css
131 chmod
644 $$(find doc
-type f
)
132 $(RSYNC
) -av doc
/ metropolis.bogomips.org
:/srv
/metropolis
/
133 git ls-files | xargs touch
135 # Create gzip variants of the same timestamp as the original so nginx
136 # "gzip_static on" can serve the gzipped versions directly.
137 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
139 for i in
$(docs
); do \
140 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
142 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test $(test_units
)