Implemented macro loader. Updated Makefile. Closes #5
This commit is contained in:
parent
b5e74ae246
commit
2254527d3d
15
main.lua
15
main.lua
|
@ -4,4 +4,19 @@ table.insert(package.loaders, fennel.make_searcher({correlate=true}))
|
|||
pp = function(x) print(fennel.view(x)) end
|
||||
lume = require("lib.lume")
|
||||
|
||||
local make_love_searcher = function(env)
|
||||
return function(module_name)
|
||||
local path = module_name:gsub("%.", "/") .. ".fnl"
|
||||
if love.filesystem.getInfo(path) then
|
||||
return function(...)
|
||||
local code = love.filesystem.read(path)
|
||||
return fennel.eval(code, {env=env}, ...)
|
||||
end, path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(package.loaders, make_love_searcher(_G))
|
||||
table.insert(fennel["macro-searchers"], make_love_searcher("_COMPILER"))
|
||||
|
||||
require("wrap")
|
||||
|
|
14
makefile
14
makefile
|
@ -9,22 +9,16 @@ DESCRIPTION="Minimal setup for trying out Phil Hagelberg's fennel/love game desi
|
|||
LIBS := $(wildcard lib/*)
|
||||
LUA := $(wildcard *.lua)
|
||||
SRC := $(wildcard *.fnl)
|
||||
OUT := $(patsubst %.fnl,%.lua,$(SRC))
|
||||
|
||||
run: ; love .
|
||||
|
||||
run: $(OUT) ; love .
|
||||
count: ; cloc *.fnl
|
||||
|
||||
count: ; cloc *.fnl --force-lang=clojure
|
||||
|
||||
clean: ; rm -rf releases/* $(OUT)
|
||||
|
||||
cleansrc: ; rm -rf $(OUT)
|
||||
|
||||
%.lua: %.fnl; lua lib/fennel --compile --correlate $< > $@
|
||||
clean: ; rm -rf releases/*
|
||||
|
||||
LOVEFILE=releases/$(NAME)-$(VERSION).love
|
||||
|
||||
$(LOVEFILE): $(LUA) $(OUT) $(LIBS)
|
||||
$(LOVEFILE): $(LUA) $(SRC) $(LIBS)
|
||||
mkdir -p releases/
|
||||
find $^ -type f | LC_ALL=C sort | env TZ=UTC zip -r -q -9 -X $@ -@
|
||||
|
||||
|
|
Loading…
Reference in a new issue