1 # Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
2 # License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
5 rubybin
:= $(shell which ruby
)
7 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
9 -include GIT-VERSION-FILE
12 ifeq ($(RUBY_TEST_OPTS
),)
19 test_units
:= $(wildcard test/test_
*.rb
)
22 $(RUBY
) -I
$(lib
) $@
$(RUBY_TEST_OPTS
)
24 test-mt
: export N
= $(shell nproc
2>/dev
/null || echo
4)
25 test-mt
: t
:= $(addprefix -r.
/,$(test_units
))
27 $(RUBY
) -I
$(lib
) $(t
) -erubyv
-- $(RUBY_TEST_OPTS
)
30 @
(for i in
$$(git ls-files
'*.rb'| grep
-v
'^setup\.rb$$'); \
31 do
$(RUBY
) -d
-W2
-c
$$i; done
) | grep
-v
'^Syntax OK$$' ||
:
34 coverage
: export COVERAGE
=1
38 $(RUBY
) .
/test/covshow.rb
40 coverage-mt
: export COVERAGE
=1
44 $(RUBY
) .
/test/covshow.rb
46 pkggem
:= pkg
/$(pkg
)-$(VERSION
).gem
47 pkgtgz
:= pkg
/$(pkg
)-$(VERSION
).
tar.gz
50 git ls-tree
-r HEAD | awk
'/^100644 / {print $$NF}' | xargs chmod
644
51 git ls-tree
-r HEAD | awk
'/^100755 / {print $$NF}' | xargs chmod
755
55 install-gem
: $(pkggem
)
56 gem
install --local
$(CURDIR
)/$<
58 $(pkggem
): .gem-manifest
59 VERSION
=$(VERSION
) gem build
$(pkg
).gemspec
63 pkg_extra
:= GIT-VERSION-FILE lib
/yahns
/version.rb NEWS
68 $(MAKE
) -C Documentation
/ gem-man
70 $(MAKE
) -C Documentation
/ install-man
mandir=$(CURDIR
)/man
71 .PHONY
: tgz-man gem-man
73 .gem-manifest
: .manifest gem-man
74 (ls man
/*.?
; cat .manifest
) | LC_ALL
=C
sort > $@
+
75 cmp
$@
+ $@ || mv
$@
+ $@
; rm -f
$@
+
76 .tgz-manifest
: .manifest
77 (ls man
/*/*; cat .manifest
) | LC_ALL
=C
sort > $@
+
78 cmp
$@
+ $@ || mv
$@
+ $@
; rm -f
$@
+
79 .manifest
: NEWS fix-perms
82 for i in
$(pkg_extra
); do echo
$$i; done
) | \
84 cmp
$@
+ $@ || mv
$@
+ $@
; rm -f
$@
+
85 $(pkgtgz
): distdir
= pkg
/$(pkg
)-$(VERSION
)
86 $(pkgtgz
): .tgz-manifest
90 tar cf
- $$(cat .tgz-manifest
) |
(cd
$(distdir
) && tar xf
-)
91 cd pkg
&& tar cf
- $(pkg
)-$(VERSION
) | gzip
-9 > $(@F
)+
94 package
: $(pkgtgz
) $(pkggem
)
96 .PHONY
: all .FORCE-GIT-VERSION-FILE
test $(test_units
) NEWS
97 .PHONY
: check-warnings fix-perms