summaryrefslogtreecommitdiff
path: root/Makefile
blob: e835f4d57bcfc64b5a766168be0a3fa9487fd4eb (plain) (blame)
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
LUA ?= lua

FNLSOURCES = core.fnl test/core.fnl test/macros.fnl test/fn.fnl
LUASOURCES = $(FNLSOURCES:.fnl=.lua)

all: $(LUASOURCES)

.PHONY: clean help test coverage all

${LUASOURCES}: $(FNLSOURCES)

%.lua: %.fnl
	fennel --lua $(LUA) --compile $< > $@

clean:
	rm -f *.lua
	rm -f test/*.lua

clean-all: clean
	rm -f luacov*

test: clean
	@fennel --lua $(LUA) --metadata test/fn.fnl
	@fennel --lua $(LUA) --metadata test/core.fnl
	@fennel --lua $(LUA) --metadata test/macros.fnl

luacov: | clean-all all luacov-stats
	luacov

luacov-console: | luacov
	@mv test/core.lua test/core.lua.tmp
	@mv test/macros.lua test/macros.lua.tmp
	@mv test/fn.lua test/fn.lua.tmp
	luacov-console .
	@mv test/core.lua.tmp test/core.lua
	@mv test/macros.lua.tmp test/macros.lua
	@mv test/fn.lua.tmp test/fn.lua

luacov-stats: test/core.lua test/macros.lua test/fn.lua
	@$(foreach test, $?, $(LUA) -lluarocks.loader -lluacov $(test);)


help:
	@echo "make                -- run tests and create lua library" >&2
	@echo "make test           -- run tests" >&2
	@echo "make clean          -- remove lua files" >&2
	@echo "make luacov         -- build coverage report (requires working tests)" >&2
	@echo "make luacov-console -- build coverage report (requires working tests)" >&2
	@echo "make help           -- print this message and exit" >&2

-include .depend.mk