about summary refs log tree commit
path: root/GNUmakefile
blob: 49ab677dab42605efd0dbbd7d7c9bd636625beab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (C) 2016 all contributors <msgthr-public@80x24.org>
# License: GPL-2.0+ <https://www.gnu.org/licenses/gpl-2.0.txt>
all::
pkg = msgthr
RUBY = ruby
lib := lib
VERSION := 0.0.0

all:: test
test_units := $(wildcard test/test_*.rb)
test: $(test_units)
$(test_units):
	$(RUBY) -w -I $(lib) $@ -v

check-warnings:
	@(for i in $$(git ls-files '*.rb'| grep -v '^setup\.rb$$'); \
	  do $(RUBY) -d -W2 -c $$i; done) | grep -v '^Syntax OK$$' || :

check: test

pkggem := pkg/$(pkg)-$(VERSION).gem

fix-perms:
	git ls-tree -r HEAD | awk '/^100644 / {print $$NF}' | xargs chmod 644

gem: $(pkggem)

install-gem: $(pkggem)
	gem install --local $(CURDIR)/$<

$(pkggem): .manifest
	VERSION=$(VERSION) gem build $(pkg).gemspec
	mkdir -p pkg
	mv $(@F) $@

pkg_extra :=

.manifest: fix-perms
	git ls-files | LC_ALL=C sort >$@+
	cmp $@+ $@ || mv $@+ $@; rm -f $@+

package: $(pkggem)

.PHONY: all test $(test_units)
.PHONY: check-warnings fix-perms