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 ($(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')
18 base_bins
:= posix-mq-rb
19 bins
:= $(addprefix bin
/, $(base_bins
))
20 man1_rdoc
:= $(addsuffix _1
, $(base_bins
))
21 man1_bins
:= $(addsuffix .1, $(base_bins
))
22 man1_paths
:= $(addprefix man
/man1
/, $(man1_bins
))
28 cp
-p bin
/* .install-tmp
31 mv .install-tmp
/* bin
/
35 setup_rb_files
:= .config InstalledFiles
36 prep_setup_rb
:= @
-$(RM
) $(setup_rb_files
);$(MAKE
) -C
$(ext
) clean
39 -$(MAKE
) -C ext
/posix_mq
clean
40 $(RM
) $(setup_rb_files
) ext
/posix_mq
/Makefile
43 $(MAKE
) -C Documentation install-
$@
45 pkg_extra
:= GIT-VERSION-FILE NEWS ChangeLog LATEST
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 ChangeLog
: GIT-VERSION-FILE
60 doc
: .document NEWS ChangeLog man html
61 for i in
$(man1_rdoc
); do
> $$i; done
64 install -m644 COPYING doc
/COPYING
65 install -m644
$(shell grep
'^[A-Z]' .document
) doc
/
66 install -m644
$(man1_paths
) doc
/
72 pkggem
:= pkg
/$(rfpackage
)-$(VERSION
).gem
73 pkgtgz
:= pkg
/$(rfpackage
)-$(VERSION
).tgz
74 release_notes
:= release_notes-
$(VERSION
)
75 release_changes
:= release_changes-
$(VERSION
)
77 release-notes
: $(release_notes
)
78 release-changes
: $(release_changes
)
80 wrongdoc release_changes
> $@
+
81 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
83 wrongdoc release_notes
> $@
+
84 $(VISUAL
) $@
+ && test -s
$@
+ && mv
$@
+ $@
86 # ensures we're actually on the tagged $(VERSION), only used for release
88 test x
"$(shell umask)" = x0022
89 git rev-parse
--verify refs
/tags/v
$(VERSION
)^
{}
90 git diff-index
--quiet HEAD^
0
91 test `git rev-parse --verify HEAD^0` = \
92 `git rev-parse --verify refs/tags/v$(VERSION)^{}`
95 -git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
96 -git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
100 install-gem
: $(pkggem
)
101 gem
install $(CURDIR
)/$<
103 $(pkggem
): manifest fix-perms
104 gem build
$(rfpackage
).gemspec
108 $(pkgtgz
): distdir
= $(basename $@
)
109 $(pkgtgz
): HEAD
= v
$(VERSION
)
110 $(pkgtgz
): manifest fix-perms
111 @
test -n
"$(distdir)"
114 tar c
`cat .manifest` |
(cd
$(distdir
) && tar x
)
115 cd pkg
&& tar c
$(basename $(@F
)) | gzip
-9 > $(@F
)+
118 package
: $(pkgtgz
) $(pkggem
)
120 test-release
: verify package
$(release_notes
) $(release_changes
)
121 release
: verify package
$(release_notes
) $(release_changes
)
122 # make tgz release on RubyForge
123 rubyforge add_release
-f
-n
$(release_notes
) -a
$(release_changes
) \
124 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkgtgz
)
125 # push gem to Gemcutter
127 # in case of gem downloads from RubyForge releases page
128 -rubyforge add_file \
129 $(rfproject
) $(rfpackage
) $(VERSION
) $(pkggem
)
131 gem install-gem
: GIT-VERSION-FILE
132 $(MAKE
) $@ VERSION
=$(GIT_VERSION
)
135 ext
:= ext
/posix_mq
/posix_mq_ext.
$(DLEXT
)
136 ext
/posix_mq
/Makefile
: ext
/posix_mq
/extconf.rb
137 cd
$(@D
) && $(RUBY
) extconf.rb
138 $(ext
): $(wildcard $(addprefix ext
/posix_mq
/,*.c
*.h
)) ext
/posix_mq
/Makefile
146 $(RUBY
) -I lib
:ext
/posix_mq
test/test_posix_mq.rb
148 # publishes docs to http://bogomips.org/ruby_posix_mq/
153 find doc
/images
-type f | \
154 TZ
=UTC xargs touch
-d
'1970-01-01 00:00:03' doc
/rdoc.css
156 $(RSYNC
) -av doc
/ bogomips.org
:/srv
/bogomips
/ruby_posix_mq
/
157 git ls-files | xargs touch
159 # Create gzip variants of the same timestamp as the original so nginx
160 # "gzip_static on" can serve the gzipped versions directly.
161 doc_gz
: docs
= $(shell find doc
-type f
! -regex
'^.*\.\(gif\|jpg\|png\|gz\)$$')
163 for i in
$(docs
); do \
164 gzip
--rsyncable
-9 < $$i > $$i.gz
; touch
-r
$$i $$i.gz
; done
166 .PHONY
: .FORCE-GIT-VERSION-FILE doc manifest man
test html