summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndrey Listopadov <andreyorst@gmail.com>2021-05-10 18:33:15 +0000
committerAndrey Listopadov <andreyorst@gmail.com>2021-05-10 18:33:15 +0000
commit3fee82f050e055ba7770a2b0135f2ebe4ee7b985 (patch)
treeca9d6e464aff19fdf6141c21f6b87e5054aa76d3 /Makefile
parent9ff8b7069da390540168723ce110b92f6d17c6b0 (diff)
Try multi value return
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile61
1 files changed, 38 insertions, 23 deletions
diff --git a/Makefile b/Makefile
index 864842d..316aa16 100644
--- a/Makefile
+++ b/Makefile
@@ -1,64 +1,79 @@
LUA ?= lua
FENNEL ?= fennel
+VERSION ?= $(shell git describe --abbrev=0)
FNLSOURCES = init.fnl
-LUASOURCES = $(FNLSOURCES:.fnl=.lua)
-FNLTESTS = tests/fn.fnl tests/macros.fnl tests/core.fnl
-FNLDOCS = init.fnl macros.fnl
+FNLMACROS = macros.fnl
+FNLTESTS = $(wildcard tests/*.fnl)
LUATESTS = $(FNLTESTS:.fnl=.lua)
-LUA_EXECUTABLES ?= lua luajit
+FNLDOCS = $(FNLMACROS) $(FNLSOURCES)
+LUASOURCES = $(FNLSOURCES:.fnl=.lua)
+LUAEXECUTABLES ?= lua luajit
FENNELDOC := $(shell command -v fenneldoc)
+LUACOV_COBERTURA := $(shell command -v luacov-cobertura)
+COMPILEFLAGS = --metadata
-.PHONY: build clean distclean help test luacov luacov-console doc $(LUA_EXECUTABLES)
+.PHONY: build clean distclean test luacov luacov-console doc help $(LUAEXECUTABLES)
build: $(LUASOURCES)
${LUASOURCES}: $(FNLSOURCES)
%.lua: %.fnl
- $(FENNEL) --lua $(LUA) --compile $< > $@
+ $(FENNEL) --lua $(LUA) $(COMPILEFLAGS) --compile $< > $@
clean:
rm -f $(LUASOURCES) $(LUATESTS)
distclean: clean
- rm -f luacov*
+ rm -rf luacov* coverage
test: $(FNLTESTS)
@echo "Testing on" $$($(LUA) -v) >&2
- @$(foreach test,$?,$(FENNEL) --lua $(LUA) --metadata $(test) || exit;)
+ @$(foreach test,$?,$(FENNEL) --lua $(LUA) $(test) || exit;)
ifdef FENNELDOC
@fenneldoc --mode check $(FNLDOCS) || exit
else
- @echo ""
+ @echo "" >&2
@echo "fenneldoc is not installed" >&2
@echo "Please install fenneldoc to check documentation during testing" >&2
@echo "https://gitlab.com/andreyorst/fenneldoc" >&2
- @echo ""
+ @echo "" >&2
endif
-testall: $(LUA_EXECUTABLES)
+testall: $(LUAEXECUTABLES)
@$(foreach lua,$?,LUA=$(lua) make test || exit;)
-luacov: build $(LUATESTS)
+luacov: COMPILEFLAGS = --no-metadata --correlate
+luacov: distclean build $(LUATESTS)
@$(foreach test,$(LUATESTS),$(LUA) -lluarocks.loader -lluacov $(test) || exit;)
luacov
+ifdef LUACOV_COBERTURA
+ mkdir -p coverage
+ luacov-cobertura -o coverage/cobertura-coverage.xml
+endif
-luacov-console: luacov
- @$(foreach test, $(LUATESTS), mv $(test) $(test).tmp;)
+luacov-console: COMPILEFLAGS = --no-metadata
+luacov-console: clean build $(LUATESTS)
+ @$(foreach test,$(LUATESTS),$(LUA) -lluarocks.loader -lluacov $(test) || exit;)
+ luacov
luacov-console .
- @$(foreach test, $(LUATESTS), mv $(test).tmp $(test);)
+ luacov-console --no-colored -s
doc:
- fenneldoc $(FNLDOCS)
+ifdef FENNELDOC
+ fenneldoc --project-version $(VERSION) --config $(FNLMACROS) $(FNLSOURCES)
+else
+ @echo "" >&2
+ @echo "fenneldoc is not installed" >&2
+ @echo "Visit https://gitlab.com/andreyorst/fenneldoc for installation instructions" >&2
+ @echo "" >&2
+endif
help:
@echo "make -- create lua library" >&2
- @echo "make doc -- generate documentation files (requires fenneldoc)" >&2
- @echo "make test -- run tests" >&2
@echo "make clean -- remove lua files" >&2
- @echo "make distclean -- remove all unnecessary files" >&2
- @echo "make luacov -- build coverage report" >&2
- @echo "make luacov-console -- build coverage report for luacov-console" >&2
+ @echo "make distclean -- remove all files not necessary for the project" >&2
+ @echo "make luacov -- run tests to produce luacov report" >&2
+ @echo "make luacov-console -- run tests to produce luacov-console report" >&2
+ @echo "make doc -- create documentation with fenneldoc" >&2
@echo "make help -- print this message and exit" >&2
-
--include .depend.mk