add Makefile targets to run in-place and to run tests

This commit is contained in:
Daniel Barlow 2025-06-17 21:57:04 +01:00
parent 360c381b33
commit 6ca0e77604
3 changed files with 18 additions and 2 deletions

View File

@ -2,7 +2,7 @@ FENNEL?=fennel
PREFIX?=/usr/local
NAME?=maps
MODULES=main.fnl
MODULES=main.fnl tiles.fnl
%.lua : %.fnl
$(FENNEL) --compile $< > $@
@ -11,6 +11,12 @@ $(NAME): $(patsubst %.fnl,%.lua,$(MODULES)) Makefile
(echo -e "#!/usr/bin/env lua\n" ; cat main.lua ) > $@
chmod +x $@
run:
( fennel fake-nmea.fnl commute.nmea /tmp/gnss & ) ; sleep 1; fennel -e '((. (require :main) :run) "/tmp/gnss")'
test:
fennel run-tests.fnl $(MODULES)
install:
mkdir -p $(PREFIX)/bin $(PREFIX)/
cp $(NAME) $(PREFIX)/bin

View File

@ -514,4 +514,4 @@ label.readout {
(when (os.getenv "MAP_PROFILE") (collect-profile))
(Gtk:main))
(run (table.unpack arg))
{ : run }

10
pkgs/maps/run-tests.fnl Normal file
View File

@ -0,0 +1,10 @@
(local fennel (require :fennel))
(local specials (require :fennel.specials))
(local compiler-env
(doto (. (specials.make-compiler-env) :_G)
(tset "RUNNING_TESTS" true)))
(each [_ f (ipairs arg)]
(print :testing f)
(fennel.dofile f { :correlate true :compilerEnv compiler-env }))