-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (24 loc) · 1.2 KB
/
Copy pathMakefile
File metadata and controls
31 lines (24 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.PHONY: generate test build_test_outputs local clean
LUA ?= lua5.1
LUA_VERSION = $(shell $(LUA) -e 'print(_VERSION:match("%d%.%d"))')
LUAROCKS = luarocks --lua-version=$(LUA_VERSION)
CLANG_FORMAT_ARGS = -style="{ColumnLimit: 0}"
SPEC_LUA_PATH = ./?.lua;./?/init.lua;$(shell $(LUAROCKS) path --lr-path);;
SPEC_LUA_CPATH = ./?.so;$(shell $(LUAROCKS) path --lr-cpath);;
generate:
pgen moonscript_parser/grammar.lua -n moonscript_parser_native \
-o moonscript_parser.c --vendor-errors moonscript_parser/errors.lua
clang-format $(CLANG_FORMAT_ARGS) -i moonscript_parser.c
pgen moonscript_parser/grammar.lua -n moonscript_parser_slow \
-o moonscript_parser/slow.lua
moonscript_parser/native.so: moonscript_parser.c
gcc -shared -o $@ -O3 -fPIC $< `pkg-config --cflags --libs lua5.1`
test: moonscript_parser/native.so
LUA_PATH="$(SPEC_LUA_PATH)" LUA_CPATH="$(SPEC_LUA_CPATH)" busted spec
TEST_SLOW=1 LUA_PATH="$(SPEC_LUA_PATH)" LUA_CPATH="$(SPEC_LUA_CPATH)" busted spec
build_test_outputs: moonscript_parser/native.so
BUILD=1 LUA_PATH="$(SPEC_LUA_PATH)" LUA_CPATH="$(SPEC_LUA_CPATH)" busted spec/tree_spec.lua
local:
$(LUAROCKS) make --local moonscript-parser-dev-1.rockspec
clean:
rm -f moonscript_parser/native.so