2015-08-21 12:24:31 +00:00
|
|
|
LUA ?= lua5.1
|
|
|
|
LUAROCKS ?= luarocks
|
|
|
|
|
|
|
|
ifneq ($(LUA),lua)
|
|
|
|
LUA_VERSION = $(shell echo $(LUA) | sed -e "s/lua\(.*\)/\1/")
|
|
|
|
LUAROCKS = luarocks-$(LUA_VERSION)
|
2015-12-28 06:29:33 +00:00
|
|
|
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")
|
2015-08-21 12:24:31 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LUA),luajit)
|
|
|
|
LUAROCKS = luarocks-5.1
|
|
|
|
endif
|
|
|
|
|
2015-12-28 06:29:33 +00:00
|
|
|
.PHONY: test local compile compile_system watch lint count show
|
2011-10-02 05:21:00 +00:00
|
|
|
|
2015-02-28 19:06:49 +00:00
|
|
|
test:
|
2015-09-27 03:59:46 +00:00
|
|
|
busted
|
2015-02-28 22:48:25 +00:00
|
|
|
|
2015-12-28 06:29:33 +00:00
|
|
|
show:
|
|
|
|
# LUA $(LUA)
|
|
|
|
# LUA_VERSION $(LUA_VERSION)
|
|
|
|
# LUAROCKS $(LUAROCKS)
|
|
|
|
# LUA_PATH_MAKE $(LUA_PATH_MAKE)
|
|
|
|
# LUA_CPATH_MAKE $(LUA_CPATH_MAKE)
|
2015-02-28 22:48:25 +00:00
|
|
|
|
2014-02-05 21:07:57 +00:00
|
|
|
local: compile
|
2015-12-28 06:29:33 +00:00
|
|
|
LUA_PATH='$(LUA_PATH_MAKE)' LUA_CPATH='$(LUA_CPATH_MAKE)' $(LUAROCKS) make --local moonscript-dev-1.rockspec
|
2011-10-02 05:21:00 +00:00
|
|
|
|
2015-02-28 19:06:49 +00:00
|
|
|
compile:
|
2015-12-28 06:29:33 +00:00
|
|
|
LUA_PATH='$(LUA_PATH_MAKE)' LUA_CPATH='$(LUA_CPATH_MAKE)' $(LUA) bin/moonc moon/ moonscript/
|
2015-06-09 04:46:28 +00:00
|
|
|
echo "#!/usr/bin/env lua" > bin/moon
|
2015-08-21 12:24:31 +00:00
|
|
|
$(LUA) bin/moonc -p bin/moon.moon >> bin/moon
|
2015-06-09 04:46:28 +00:00
|
|
|
echo "-- vim: set filetype=lua:" >> bin/moon
|
2012-01-09 06:02:43 +00:00
|
|
|
|
2015-09-27 01:05:00 +00:00
|
|
|
compile_system:
|
|
|
|
moonc moon/ moonscript/
|
|
|
|
echo "#!/usr/bin/env lua" > bin/moon
|
|
|
|
moonc -p bin/moon.moon >> bin/moon
|
|
|
|
echo "-- vim: set filetype=lua:" >> bin/moon
|
|
|
|
|
2012-01-09 06:02:43 +00:00
|
|
|
watch:
|
2013-06-08 06:33:47 +00:00
|
|
|
moonc moon/ moonscript/ && moonc -w moon/ moonscript/
|
2015-02-28 19:06:49 +00:00
|
|
|
|
|
|
|
lint:
|
2015-06-09 05:03:11 +00:00
|
|
|
moonc -l moonscript moon bin
|
2015-12-06 05:34:32 +00:00
|
|
|
|
|
|
|
count:
|
|
|
|
wc -l $$(git ls-files | grep 'moon$$') | sort -n | tail
|