2015-01-09 08:25:40 +03:00
|
|
|
SOURCES_BASE = utils.lua types.lua reader.lua printer.lua
|
2015-02-28 20:09:54 +03:00
|
|
|
SOURCES_LISP = env.lua core.lua stepA_mal.lua
|
2015-01-09 08:25:40 +03:00
|
|
|
SOURCES = $(SOURCES_BASE) $(SOURCES_LISP)
|
|
|
|
|
|
|
|
all: libs
|
|
|
|
|
2016-02-24 09:45:40 +03:00
|
|
|
dist: mal.lua mal
|
2016-02-18 09:33:19 +03:00
|
|
|
|
|
|
|
SOURCE_NAMES = $(patsubst %.lua,%,$(SOURCES))
|
|
|
|
mal.lua: $(SOURCES)
|
2016-02-24 09:45:40 +03:00
|
|
|
echo "local $(foreach n,$(SOURCE_NAMES),$(n),) M" > $@
|
2016-02-18 09:33:19 +03:00
|
|
|
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)')") >> $@
|
2016-02-24 09:45:40 +03:00
|
|
|
|
|
|
|
mal: mal.lua
|
|
|
|
echo "#!/usr/bin/env lua" > $@
|
|
|
|
cat $< >> $@
|
2016-02-18 09:33:19 +03:00
|
|
|
chmod +x $@
|
|
|
|
|
2015-01-09 08:25:40 +03:00
|
|
|
|
|
|
|
clean:
|
2020-05-15 22:05:10 +03:00
|
|
|
rm -f linenoise.so rex_pcre.so mal.lua mal
|
2020-05-15 20:32:55 +03:00
|
|
|
rm -rf lib
|
2015-01-09 08:25:40 +03:00
|
|
|
|
|
|
|
.PHONY: libs
|
2020-05-15 22:05:10 +03:00
|
|
|
libs: linenoise.so rex_pcre.so
|
2015-01-09 08:25:40 +03:00
|
|
|
|
|
|
|
linenoise.so:
|
|
|
|
luarocks install --tree=./ linenoise
|
2020-05-15 20:32:55 +03:00
|
|
|
ln -sf $$(find . -name linenoise.so) $@
|
2015-01-09 08:25:40 +03:00
|
|
|
|
2020-05-15 22:05:10 +03:00
|
|
|
rex_pcre.so:
|
|
|
|
luarocks install --tree=./ lrexlib-pcre
|
|
|
|
ln -sf $$(find . -name rex_pcre.so) $@
|
|
|
|
|