-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
87 lines (62 loc) · 1.97 KB
/
Copy pathMakefile
File metadata and controls
87 lines (62 loc) · 1.97 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
ZIG ?= ./tools/zig
ZIG_BUILD_FLAGS ?=
LUA_DIR := lua-5.5.0
LUA_SRC := $(LUA_DIR)/src
LUA_C_OUT := build/lua-c
LUA_BIN := $(LUA_C_OUT)/lua
LUAC_BIN := $(LUA_C_OUT)/luac
.PHONY: all lua-c run-lua-c zig run-zig run-zigc fmt test test-suite test-smoke test-compile test-compile-upstream test-guard test-errors-probe tokens parse ast ir clean
.PHONY: test-suite-zig test-upstream
all: lua-c zig
build:
@mkdir -p build
lua-c: build
$(MAKE) -C $(LUA_SRC) linux
@mkdir -p $(LUA_C_OUT)
@cp -f $(LUA_SRC)/lua $(LUA_BIN)
@cp -f $(LUA_SRC)/luac $(LUAC_BIN)
run-lua-c: lua-c
@$(LUA_BIN)
zig:
@$(ZIG) build $(ZIG_BUILD_FLAGS)
run-zig:
@$(ZIG) build $(ZIG_BUILD_FLAGS) run
run-zigc:
@$(ZIG) build $(ZIG_BUILD_FLAGS) -Doptimize=Debug && ./zig-out/bin/luazigc
fmt:
@$(ZIG) fmt build.zig src
test:
@$(ZIG) build $(ZIG_BUILD_FLAGS) test
test-suite: lua-c zig
@python3 tools/run_tests.py
# Run upstream suite under our Zig VM and compare output against reference Lua.
test-suite-zig: lua-c zig
@python3 tools/run_tests.py --mode compare --prelude ""
# Run a single upstream test file (FILE=errors.lua) under Zig VM and compare.
test-upstream: lua-c zig
@test -n "$(FILE)"
@python3 tools/run_tests.py --mode compare --prelude "" --suite "$(FILE)"
test-smoke: lua-c zig
@python3 tools/smoke_compare.py --no-build
test-compile: lua-c zig
@python3 tools/compile_compare.py --list tests/compile_list.txt
test-compile-upstream: lua-c zig
@python3 tools/compile_compare.py --dir lua-5.5.0/testes --glob '*.lua'
test-guard: zig
@python3 tools/regression_guard.py --no-build
test-errors-probe: lua-c zig
@python3 tools/errors_probe.py
tokens: zig
@test -n "$(FILE)"
@./zig-out/bin/luazigc --engine=zig --tokens "$(FILE)"
parse: zig
@test -n "$(FILE)"
@./zig-out/bin/luazigc --engine=zig -p "$(FILE)"
ast: zig
@test -n "$(FILE)"
@./zig-out/bin/luazigc --engine=zig --ast "$(FILE)"
ir: zig
@test -n "$(FILE)"
@./zig-out/bin/luazigc --engine=zig --ir "$(FILE)"
clean:
@rm -rf zig-cache zig-out build