summaryrefslogtreecommitdiff
path: root/Makefile
blob: d353947eb2cd261d1549d642430904c26a241d40 (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
all: test

MODULES := clod
LUA_VER := 5.1

INST_BASE := /usr/local
INST_ROOT := $(DESTDIR)$(INST_BASE)/share/lua/$(LUA_VER)

MOD_FILES := $(patsubst %,%.lua,$(subst .,/,$(MODULES)))

install:
	mkdir -p $(INST_ROOT)
	for MOD in $(sort $(MOD_FILES)); do \
		cp lib/$${MOD} $(INST_ROOT)/$${MOD}; \
	done

LUA := LUA_PATH="$(shell pwd)/lib/?.lua;$(shell pwd)/extras/luacov/src/?.lua;;" lua$(LUA_VER)

clean:
	$(RM) luacov.report.out luacov.stats.out

distclean: clean
	find . -name "*~" -delete

.PHONY: example
example:
	$(LUA) example/simple-config-reader.lua
	$(LUA) example/change-setting.lua
	$(LUA) example/config-passthru.lua

.PHONY: test
test:
	@$(RM) luacov.stats.out
	@ERR=0; \
	for MOD in $(sort $(MODULES)); do \
		echo -n "$${MOD}: "; \
		$(LUA) test/test-$${MOD}.lua; \
		test "x$$?" = "x0" || ERR=1; \
	done; \
	$(LUA) extras/luacov/src/bin/luacov -X luacov. -X test. $(MODULES); \
	exit $$ERR

.PHONY: interactive
interactive:
	$(LUA) -e'clod=require"clod"' -i