-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (42 loc) · 1.51 KB
/
Makefile
File metadata and controls
51 lines (42 loc) · 1.51 KB
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
46
47
48
49
50
51
.PHONY: release clean github-release
PKGCONFIG = pkg-config
CFLAGS = -Wall -Wextra -g -O2 -fPIC
LDFLAGS =
LUA=lua
CFLAGS += $(shell $(PKGCONFIG) --cflags $(LUA))
VERSION = $(shell LUA_CPATH="./csrc/?.so" lua -e 'print(require("etf")._VERSION)')
lib: csrc/etf.so
csrc/etf.so: csrc/etf.c
$(CC) -shared $(CFLAGS) -o $@ $^ $(LDFLAGS)
github-release: lib
source $(HOME)/.github-token && github-release release \
--user jprjr \
--repo lua-etf \
--tag v$(VERSION)
source $(HOME)/.github-token && github-release upload \
--user jprjr \
--repo lua-etf \
--tag v$(VERSION) \
--name lua-etf-$(VERSION).tar.gz \
--file dist/lua-etf-$(VERSION).tar.gz
source $(HOME)/.github-token && github-release upload \
--user jprjr \
--repo lua-etf \
--tag v$(VERSION) \
--name lua-etf-$(VERSION).tar.xz \
--file dist/lua-etf-$(VERSION).tar.xz
release: lib
rm -rf dist/lua-etf-$(VERSION)
rm -rf dist/lua-etf-$(VERSION).tar.gz
rm -rf dist/lua-etf-$(VERSION).tar.xz
mkdir -p dist/lua-etf-$(VERSION)/csrc
rsync -a --exclude='*.so' csrc/ dist/lua-etf-$(VERSION)/csrc/
rsync -a LICENSE dist/lua-etf-$(VERSION)/LICENSE
rsync -a README.md dist/lua-etf-$(VERSION)/README.md
rsync -a CMakeLists.txt dist/lua-etf-$(VERSION)/CMakeLists.txt
sed 's/@VERSION@/$(VERSION)/g' < etf-template.rockspec > dist/lua-etf-$(VERSION)/etf-$(VERSION)-1.rockspec
cd dist && tar -c -f lua-etf-$(VERSION).tar lua-etf-$(VERSION)
cd dist && gzip -k lua-etf-$(VERSION).tar
cd dist && xz lua-etf-$(VERSION).tar
clean:
rm -f csrc/etf.so