forked from Pyrlang/Pyrlang
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
106 lines (88 loc) · 2.94 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
ROOT=$(shell pwd)
PYPATH_SET=PYTHONPATH=$(ROOT):$(ROOT)/../Term
PY=$(PYPATH_SET) PYRLANG_ENABLE_LOG_FORMAT=1 PYRLANG_LOG_LEVEL=DEBUG python3
ERLLIBDIR=$(ROOT)/py.erl
# Set ERLBIN to use some custom erlang version
ERLBIN ?=
ERL=$(ERLBIN)erl -pa $(ERLLIBDIR) $(ROOT)/examples -name [email protected] -setcookie COOKIE
.PHONY: example1
example1:
$(PY) examples/e01_simple_node.py
# `make pynode` is same as example2, will run an idle Python node as [email protected]
.PHONY: example2 pynode
pynode: example2
example2:
$(PY) examples/e02_registered_process.py
.PHONY: example3
example3: $(ERLLIBDIR)/py.beam $(ROOT)/examples/e03_call_python.beam
$(ERL) -s e03_call_python -noshell
.PHONY: example4
example4: $(ERLLIBDIR)/py.beam $(ROOT)/examples/e04_batch_call_python.beam
$(ERL) -s e04_batch_call_python -noshell
# Run `make example5a` to run Erlang node
# Run `make example5b` to run Python node and wait for them to interact
.PHONY: example5a example5b
example5a: $(ROOT)/examples/e05_erl_link_monitor_python.beam
$(ERL) -s e05_erl_link_monitor_python -noshell
example5b:
$(PY) examples/e05_erl_link_monitor_python.py
# Run `make example6a` to run Erlang node
# Run `make example6b` to run Python node and wait for them to interact
.PHONY: example6a example6b
example6a: $(ROOT)/examples/e06_py_link_erlang.beam
$(ERL) -s e06_py_link_erlang -noshell
example6b:
$(PY) examples/e06_py_link_erlang.py
# Run `make example7a` to run Erlang node
# Run `make example7b` to run Python node and wait for them to interact
.PHONY: example7a example7b
example7a: $(ROOT)/examples/e07_py_monitor_erlang.beam
$(ERL) -s e07_py_monitor_erlang -noshell
example7b:
$(PY) examples/e07_py_monitor_erlang.py
# Run `make example8a` to run Erlang node
# Run `make example8b` to run Python node 1
# Run `make example8c` to run Python node 2
# wait and se how they interact
.PHONY: example8a example8b example8c
example8a: $(ROOT)/examples/e08_multiple_py_nodes.beam
$(ERL) -s e08_multiple_py_nodes -noshell
example8b:
$(PY) examples/e08_pynode.py '[email protected]'
example8c:
$(PY) examples/e08_pynode.py '[email protected]'
# Run `make example10a` to run Python node
# Run `make example10b` to run Elixir client
.PHONY: example10a example10b
example10a:
$(PY) examples/elixir/e10.py
example10b:
elixir --name [email protected] --cookie COOKIE \
examples/elixir/e10.exs
$(ROOT)/examples/%.beam: $(ROOT)/examples/%.erl
cd $(ROOT)/examples && erlc $<
$(ERLLIBDIR)/%.beam: $(ERLLIBDIR)/%.erl
cd $(ERLLIBDIR) && erlc $<
.PHONY: erlshell
erlshell:
$(ERL)
.PHONY: deps
deps:
pip3 install -r requirements.txt
.PHONY: docs
docs:
rm -rf $(ROOT)/docs; \
cd docs-src && \
$(MAKE) html && \
mv -f $(ROOT)/docs-src/build/html $(ROOT)/docs && \
touch $(ROOT)/docs/.nojekyll
.PHONY: test
test:
for f in $(shell ls test/*_test.py); do \
echo "RUNNING $$f"; \
$(PY) $$f || exit 1; \
done
# Run Pyre type check (requires: pip install pyre-check):
.PHONY: pyre
pyre:
PYTHONPATH=$(ROOT):$(ROOT)/../term/ pyre check