summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 44 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..e5be3ad
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+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:
+ 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