moonscript/Makefile

36 lines
1000 B
Makefile
Raw Normal View History

2016-01-19 17:26:50 +00:00
LUA ?= lua5.1
LUA_VERSION = $(shell $(LUA) -e 'print(_VERSION:match("%d%.%d"))')
2022-11-04 19:49:30 +00:00
LUAROCKS = luarocks --lua-version=$(LUA_VERSION)
2016-03-30 20:26:53 +00:00
LUA_PATH_MAKE = $(shell $(LUAROCKS) path --lr-path);./?.lua;./?/init.lua
LUA_CPATH_MAKE = $(shell $(LUAROCKS) path --lr-cpath);./?.so
2022-11-04 20:04:11 +00:00
.PHONY: test local build watch lint count show
2011-10-02 05:21:00 +00:00
2022-11-04 20:04:11 +00:00
build:
LUA_PATH='$(LUA_PATH_MAKE)' LUA_CPATH='$(LUA_CPATH_MAKE)' $(LUA) bin/moonc moon/ moonscript/
echo "#!/usr/bin/env lua" > bin/moon
$(LUA) bin/moonc -p bin/moon.moon >> bin/moon
echo "-- vim: set filetype=lua:" >> bin/moon
2015-02-28 22:48:25 +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
2022-11-04 20:04:11 +00:00
test: build
busted
2011-10-02 05:21:00 +00:00
2022-11-04 20:04:11 +00:00
local: build
LUA_PATH='$(LUA_PATH_MAKE)' LUA_CPATH='$(LUA_CPATH_MAKE)' $(LUAROCKS) make --local moonscript-dev-1.rockspec
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