summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6d733deb0ab8faf1e6fc5630e58f2fc75a8aed85 (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
46
47
48
49
50
all: test doc

MODULES := lace lace.lex lace.compiler lace.builtin lace.engine lace.error
LUA_VER := 5.1

PREFIX ?= /usr/local

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

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

install:
	mkdir -p $(INST_ROOT)/lace
	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
	$(RM) -r html

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

.PHONY: example
example:
	$(LUA) example/lace-example.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'lace=require"lace"' -i

doc:
	@echo "Running LDoc"
	@ldoc .