1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 21:57:38 +03:00
mal/impls/lua/Makefile

40 lines
886 B
Makefile
Raw Normal View History

SOURCES_BASE = utils.lua types.lua reader.lua printer.lua
SOURCES_LISP = env.lua core.lua stepA_mal.lua
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
all: libs
dist: mal.lua mal
SOURCE_NAMES = $(patsubst %.lua,%,$(SOURCES))
mal.lua: $(SOURCES)
echo "local $(foreach n,$(SOURCE_NAMES),$(n),) M" > $@
echo "M={} $(foreach n,$(SOURCE_NAMES),$(n)=M);" >> $@
cat $+ | grep -v -e "return M$$" \
-e "return Env" \
-e "local M =" \
-e "^#!" \
$(foreach n,$(SOURCE_NAMES),-e "require('$(n)')") >> $@
mal: mal.lua
echo "#!/usr/bin/env lua" > $@
cat $< >> $@
chmod +x $@
clean:
2020-05-15 22:05:10 +03:00
rm -f linenoise.so rex_pcre.so mal.lua mal
rm -rf lib
.PHONY: libs
2020-05-15 22:05:10 +03:00
libs: linenoise.so rex_pcre.so
linenoise.so:
luarocks install --tree=./ linenoise
ln -sf $$(find . -name linenoise.so) $@
2020-05-15 22:05:10 +03:00
rex_pcre.so:
luarocks install --tree=./ lrexlib-pcre
ln -sf $$(find . -name rex_pcre.so) $@