-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (55 loc) · 1.76 KB
/
Makefile
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
LUA54 = lua5.4
LUA51 = lua5.1
LUA_VERSIONS := $(LUA54) $(LUA51) lua
TEST_DIR = tests
TEST_LUA_FILES = $(wildcard $(TEST_DIR)/test_*.lua)
TEST_EQX_FILES = $(wildcard $(TEST_DIR)/test_*.eqx)
EQUINOX = equinox.lua
BUNDLE = equinox_bundle.lua
AMALG = amalg.lua
GREEN := \033[0;32m
RED := \033[0;31m
NC := \033[0m
all: clean test version bundle
test:
@for luaver in $(LUA_VERSIONS); do \
echo "* $$luaver"; \
if ! command -v $$luaver > /dev/null 2>&1; then \
echo "$$luaver is not installed skippping"; \
else \
echo "Running Lua tests ..."; \
for file in $(TEST_LUA_FILES); do \
echo " - $$file..."; \
$$luaver $$file || exit 1; \
done; \
echo "Running Equinox tests with -o0 ..."; \
for file in $(TEST_EQX_FILES); do \
echo " - $$file..."; \
$$luaver $(EQUINOX) -o0 $$file || exit 1; \
done; \
echo "Running Equinox tests with -o1 ..."; \
for file in $(TEST_EQX_FILES); do \
echo " - $$file..."; \
$$luaver $(EQUINOX) -o1 $$file || exit 1; \
done; \
echo "Running optimizer tests"; \
$$luaver $(EQUINOX) -od "tests/test_optimizer.eqx" > "tests/opt.out" || exit 1; \
diff "tests/opt.out" "tests/opt.expected" || exit 1; \
fi; \
done
@echo "$(GREEN)All tests passed!$(NC)"
version:
@echo "Increase patch version"
lua version/version.lua
bundle:
@version=$$(cat "version/version.txt") ; \
echo "Creating $(BUNDLE) v$$version" ; \
$(AMALG) -s $(EQUINOX) compiler codegen ast_optimizer ast_matchers aux dict ast line_mapping interop parser macros output stack_def repl stack -o $(BUNDLE); \
sed -i "s/^__VERSION__=.*$$/__VERSION__=\"$$version\"/" $(BUNDLE); \
repl:
lua $(EQUINOX)
clean:
@echo "Cleaning up"
rm -f $(BUNDLE)
# Add a phony directive to prevent file conflicts
.PHONY: all test clean bundle repl version