-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (38 loc) · 1.21 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
# distributed algorithms, n.dulay, 4 feb 2020
# Makefile, raft consensus, v1
# Leyang Shen (ls2617)
SHELL := /bin/bash
SERVERS = 5
CLIENTS = 5
START = Raft.start
MAX_TIME = 10000
CONFIGJSON=
HOST := 127.0.0.1
# --------------------------------------------------------------------
TIME := $(shell date +%H:%M:%S)
SECS := $(shell date +%S)
COOKIE := $(shell echo $$PPID)
NODE_SUFFIX := ${SECS}_${LOGNAME}@${HOST}
ELIXIR := elixir --no-halt --cookie ${COOKIE} --name
MIX := -S mix run -e ${START} ${MAX_TIME} ${NODE_SUFFIX} ${SERVERS} ${CLIENTS}
# --------------------------------------------------------------------
compile: install
mix compile
run run_multi: compile
@for (( i=0; i<${SERVERS}; i++ )); do \
${ELIXIR} server$${i}_${NODE_SUFFIX} ${MIX} multi_node_wait ${CONFIGJSON} & \
done;
@for (( i=0; i<${CLIENTS}; i++ )); do \
${ELIXIR} client$${i}_${NODE_SUFFIX} ${MIX} multi_node_wait ${CONFIGJSON} & \
done
@sleep 2
@ ${ELIXIR} raft_${NODE_SUFFIX} ${MIX} multi_node_start ${CONFIGJSON}
clean:
mix clean
@rm -f erl_crash.dump
install:
mix deps.get
# -- 'make ps' will list Elixir nodes running locally
ps:
@echo ------------------------------------------------------------
epmd -names