LUA=lua5.1 as default, and detect luarocks and LUA_{C,}PATH

This commit is contained in:
nymphium 2015-08-21 21:24:31 +09:00
parent db523926d3
commit 0d330c8416
2 changed files with 21 additions and 6 deletions

View File

@ -1,3 +1,18 @@
LUA ?= lua5.1
LUAROCKS ?= luarocks
ifneq ($(LUA),lua)
LUA_VERSION = $(shell echo $(LUA) | sed -e "s/lua\(.*\)/\1/")
LUAROCKS = luarocks-$(LUA_VERSION)
LUA_PATH_MAKE = $(shell echo "${LUA_PATH}" | sed -e "s/[0-9]\.[0-9]/$(LUA_VERSION)/g")
LUA_CPATH_MAKE = $(shell echo "${LUA_CPATH}" | sed -e "s/[0-9]\.[0-9]/$(LUA_VERSION)/g")
endif
ifeq ($(LUA),luajit)
LUAROCKS = luarocks-5.1
endif
.PHONY: test local compile watch lint test_safe .PHONY: test local compile watch lint test_safe
test: test:
@ -7,15 +22,15 @@ test_safe:
busted -p "_spec.lua$$" busted -p "_spec.lua$$"
local: compile local: compile
luarocks make --local moonscript-dev-1.rockspec LUA_PATH=$(LUA_PATH_MAKE) LUA_CPATH=$(LUA_CPATH_MAKE) $(LUAROCKS) make --local moonscript-dev-1.rockspec
global: global:
sudo luarocks make moonscript-dev-1.rockspec sudo LUA_PATH=$(LUA_PATH_MAKE) LUA_CPATH=$(LUA_CPATH_MAKE) $(LUAROCKS) make moonscript-dev-1.rockspec
compile: compile: init
lua bin/moonc moon/ moonscript/ LUA_PATH=$(LUA_PATH_MAKE) LUA_CPATH=$(LUA_CPATH_MAKE) $(LUA) bin/moonc moon/ moonscript/
echo "#!/usr/bin/env lua" > bin/moon echo "#!/usr/bin/env lua" > bin/moon
lua bin/moonc -p bin/moon.moon >> bin/moon $(LUA) bin/moonc -p bin/moon.moon >> bin/moon
echo "-- vim: set filetype=lua:" >> bin/moon echo "-- vim: set filetype=lua:" >> bin/moon
watch: watch:

View File

@ -291,7 +291,7 @@ build_grammar = wrap_env debug_grammar, (root) ->
op"*" + op"^" + op"*" + op"^" +
Ct(NameList) * (sym"=" * Ct(ExpListLow))^-1) / mark"export" Ct(NameList) * (sym"=" * Ct(ExpListLow))^-1) / mark"export"
KeyValue: (sym":" * -SomeSpace * Name * lpeg.Cp()) / self_assign + Ct((KeyName + sym"[" * Exp * sym"]" + DoubleString + SingleString) * symx":" * (Exp + TableBlock + SpaceBreak^1 * Exp)) KeyValue: (sym":" * -SomeSpace * Name * lpeg.Cp!) / self_assign + Ct((KeyName + sym"[" * Exp * sym"]" + DoubleString + SingleString) * symx":" * (Exp + TableBlock + SpaceBreak^1 * Exp))
KeyValueList: KeyValue * (sym"," * KeyValue)^0 KeyValueList: KeyValue * (sym"," * KeyValue)^0
KeyValueLine: CheckIndent * KeyValueList * sym","^-1 KeyValueLine: CheckIndent * KeyValueList * sym","^-1