Debian Codegraph @

Makefile

raw
1
2 ifeq ($(wildcard bed),bed)
3 LUA := $(CURDIR)/bed/bin/lua
4 else
5 LUA := lua
6 endif
7 VERSION := $(shell LUA_PATH=";;src/?.lua" $(LUA) -e "m = require [[MessagePack]]; print(m._VERSION)")
8 TARBALL := lua-messagepack-$(VERSION).tar.gz
9 REV := 1
10
11 LUAVER := 5.2
12 PREFIX := /usr/local
13 DPREFIX := $(DESTDIR)$(PREFIX)
14 LIBDIR := $(DPREFIX)/share/lua/$(LUAVER)
15 INSTALL := install
16
17 ifeq ($(LUAVER),5.3)
18 SRC := src5.3
19 else
20 SRC := src
21 endif
22
23 BED_OPTS:= --lua latest
24
25 all:
26 @echo "Nothing to build here, you can just make install"
27
28 install:
29 $(INSTALL) -m 644 -D $(SRC)/MessagePack.lua $(LIBDIR)/MessagePack.lua
30
31 uninstall:
32 rm -f $(LIBDIR)/MessagePack.lua
33
34 manifest_pl := \
35 use strict; \
36 use warnings; \
37 my @files = qw{MANIFEST}; \
38 while (<>) { \
39 chomp; \
40 next if m{^\.}; \
41 next if m{^rockspec/}; \
42 push @files, $$_; \
43 } \
44 print join qq{\n}, sort @files;
45
46 rockspec_pl := \
47 use strict; \
48 use warnings; \
49 use Digest::MD5; \
50 open my $$FH, q{<}, q{$(TARBALL)} \
51 or die qq{Cannot open $(TARBALL) ($$!)}; \
52 binmode $$FH; \
53 my %config = ( \
54 version => q{$(VERSION)}, \
55 rev => q{$(REV)}, \
56 md5 => Digest::MD5->new->addfile($$FH)->hexdigest(), \
57 ); \
58 close $$FH; \
59 while (<>) { \
60 s{@(\w+)@}{$$config{$$1}}g; \
61 print; \
62 }
63
64 version:
65 @echo $(VERSION)
66
67 CHANGES:
68 perl -i.bak -pe "s{^$(VERSION).*}{q{$(VERSION) }.localtime()}e" CHANGES
69
70 tag:
71 git tag -a -m 'tag release $(VERSION)' $(VERSION)
72
73 MANIFEST:
74 git ls-files | perl -e '$(manifest_pl)' > MANIFEST
75
76 $(TARBALL): MANIFEST
77 [ -d lua-MessagePack-$(VERSION) ] || ln -s . lua-MessagePack-$(VERSION)
78 perl -ne 'print qq{lua-MessagePack-$(VERSION)/$$_};' MANIFEST | \
79 tar -zc -T - -f $(TARBALL)
80 rm lua-MessagePack-$(VERSION)
81
82 dist: $(TARBALL)
83
84 rockspec: $(TARBALL)
85 perl -e '$(rockspec_pl)' rockspec.in > rockspec/lua-messagepack-$(VERSION)-$(REV).rockspec
86 perl -e '$(rockspec_pl)' rockspec.lua53.in > rockspec/lua-messagepack-lua53-$(VERSION)-$(REV).rockspec
87
88 rock:
89 luarocks pack rockspec/lua-messagepack-$(VERSION)-$(REV).rockspec
90 luarocks pack rockspec/lua-messagepack-lua53-$(VERSION)-$(REV).rockspec
91
92 bed:
93 hererocks bed $(BED_OPTS) --no-readline --luarocks latest --verbose
94 bed/bin/luarocks install lua-testmore
95 bed/bin/luarocks install lua-coat
96 bed/bin/luarocks install lbc
97 bed/bin/luarocks install luacov
98 hererocks bed --show
99 bed/bin/luarocks list
100
101 check: test
102
103 test:
104 LUA_PATH=";;$(CURDIR)/$(SRC)/?.lua" \
105 prove --exec=$(LUA) test/*.lua
106
107 luacheck:
108 luacheck --std=max --codes src --ignore 211/_ENV 212 213 311/j 631
109 luacheck --std=max --codes src5.3 --ignore 211/_ENV 212 213 311/j
110 luacheck --std=max --config .test.luacheckrc test
111
112 coverage:
113 rm -f luacov.*
114 -LUA_PATH=";;$(CURDIR)/$(SRC)/?.lua" \
115 prove --exec="$(LUA) -lluacov" test/*.lua
116 luacov-console $(CURDIR)/src
117 luacov-console -s $(CURDIR)/src
118 luacov-console test
119 luacov-console -s test
120
121 README.html: README.md
122 Markdown.pl README.md > README.html
123
124 pages:
125 mkdocs build -d public
126
127 clean:
128 rm -f MANIFEST *.bak luacov.* README.html
129
130 realclean: clean
131 rm -rf bed
132
133 .PHONY: test rockspec CHANGES
134