-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (38 loc) · 1.49 KB
/
Makefile
File metadata and controls
50 lines (38 loc) · 1.49 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
# Variables
SCRIPTS_PATH=mopl_examples/
INTERPRETER_PATH=interpreter/
GO_INTERPRETER=$(INTERPRETER_PATH)go/interpreter.go
PY_INTERPRETER=$(INTERPRETER_PATH)python/interpreter.py
TESTS_PATH=tests/
TEST_RUNNER=$(TESTS_PATH)test_runner.py
# Default script (can be overridden)
SCRIPT?=$(SCRIPTS_PATH)count_down.mopl
.PHONY: interpret-go interpret-python test clean-test clean
# ============================================================================
# Interpreter targets
# ============================================================================
# Run the Go interpreter with a script name argument
interpret-go:
@if [ -z "$(script)" ] && [ -z "$(SCRIPT)" ]; then \
echo "Error: script argument is required."; exit 1; \
fi
go run $(GO_INTERPRETER) $${script:-$(SCRIPT)}
# Run the Python interpreter with a script name argument
interpret-py:
@if [ -z "$(script)" ] && [ -z "$(SCRIPT)" ]; then \
echo "Error: script argument is required."; exit 1; \
fi
python3 $(PY_INTERPRETER) $${script:-$(SCRIPT)}
# ============================================================================
# Testing targets
# ============================================================================
# Run all tests for both interpreters
test:
python3 $(TEST_RUNNER)
clean-test:
rm -f tests/test_results.json
# ============================================================================
# Util targets
# ============================================================================
clean: clean-test
@echo "Cleaning up..."