Skip to content

Commit 30bdf81

Browse files
committed
chore(build): Add Makefile to normalize common jobs
1 parent cc476c0 commit 30bdf81

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

Makefile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
PACKAGE = fluent
2+
VERSION != git describe --tags --all --abbrev=7 | sed 's/-/-r/'
3+
SEMVER != git describe --tags | sed 's/^v//;s/-.*//'
4+
ROCKREV = 0
5+
TAG = v$(SEMVER)
6+
7+
LUAROCKS_ARGS ?= --local --tree lua_modules
8+
9+
SCM_ROCK = $(PACKAGE)-scm-0.rockspec
10+
REL_ROCK = rockspecs/$(PACKAGE)-$(SEMVER)-$(ROCKREV).rockspec
11+
SCM_SRC = $(PACKAGE)-scm-0.src.rock
12+
REL_SRC = $(PACKAGE)-$(SEMVER)-$(ROCKREV).src.rock
13+
14+
.PHONY: all
15+
all: $(SCM_ROCK) $(SCM_SRC)
16+
17+
.PHONY: dist
18+
dist: $(REL_ROCK) $(REL_SRC)
19+
20+
.PHONY: install
21+
install:
22+
luarocks $(LUAROCKS_ARGS) make $(SCM_ROCK)
23+
24+
define rockpec_template =
25+
sed -e "s/@SEMVER@/$(SEMVER)/g" \
26+
-e "s/@ROCKREV@/$(ROCKREV)/g" \
27+
-e "s/@TAG@/$(TAG)/g" \
28+
$< > $@
29+
endef
30+
31+
$(SCM_ROCK): SEMVER = scm
32+
$(SCM_ROCK): TAG = master
33+
$(SCM_ROCK): $(PACKAGE).rockspec.in
34+
$(rockpec_template)
35+
36+
rockspecs/$(PACKAGE)-%-0.rockspec: SEMVER = $*
37+
rockspecs/$(PACKAGE)-%-0.rockspec: TAG = v$*
38+
rockspecs/$(PACKAGE)-%-0.rockspec: $(PACKAGE).rockspec.in
39+
$(rockpec_template)
40+
41+
$(PACKAGE)-scm-0.src.rock: $(SCM_ROCK)
42+
luarocks $(LUAROCKS_ARGS) pack $<
43+
44+
$(PACKAGE)-%.src.rock: rockspecs/$(PACKAGE)-%.rockspec
45+
luarocks $(LUAROCKS_ARGS) pack $<
46+
47+
.PHONY: check
48+
check:
49+
luacheck .
50+
51+
.PHONY: test
52+
test:
53+
busted

0 commit comments

Comments
 (0)