-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (78 loc) · 4.13 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
################################################################################
## Project configurations ##
################################################################################
BIN=ebin
INCLUDE=include
SRC=src
TEST=test
CMD=./src/paterl
# If the first argument is the target name 'run', strip the first word and keep
# the rest as command line arguments.
ifeq (run,$(firstword $(MAKECMDGOALS)))
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
# Turn the remaining words as do-nothing targets to suppress Make warnings.
$(eval $(RUN_ARGS):;@:)
endif
# Set shell to bash to use certain commands such as source.
SHELL=/bin/bash
define recursive
$(shell find $(1) -name "*.$(2)")
endef
all: compile
compile: clean
mkdir -p $(BIN)
erlc -pa $(BIN) +debug_info -I $(INCLUDE) -W0 -o $(BIN) $(call recursive,$(SRC),erl)
compile-test: clean
mkdir -p $(BIN)
erlc -DTEST -Dlog -pa $(BIN) +debug_info -W0 -I $(INCLUDE) -o $(BIN) $(call recursive,$(SRC),erl)
erlc -DTEST -Dlog -pa $(BIN) -I $(INCLUDE) -W0 -o $(BIN) $(call recursive,$(TEST),erl)
test: compile-test
#erl -noshell -pa $(BIN) -eval 'case eunit:test(log_tracer_test, [verbose]) of error -> init:stop(1); Result -> Result end.' -s init stop
#erl -noshell -pa $(BIN) -eval 'case eunit:test(async_tracer_test, [verbose]) of error -> init:stop(1); Result -> Result end.' -s init stop
echo "CodeBEAM/ID server test"
$(CMD) $(SRC)/examples/erlang/codebeam/id_server_demo.erl -v all -I include -o $(BIN)
diff $(BIN)/id_server_demo $(TEST)/generated/codebeam/id_server_demo_ref
echo "CodeBEAM/ID TS server test"
$(CMD) $(SRC)/examples/erlang/codebeam/id_ts_server_demo.erl -v all -I include -o $(BIN)
diff $(BIN)/id_ts_server_demo $(TEST)/generated/codebeam/id_ts_server_demo_ref
echo "De'Liguoro & Padovani/Future test"
$(CMD) $(SRC)/examples/erlang/de_liguoro_padovani/future.erl -v all -I include -o $(BIN)
diff $(BIN)/future $(TEST)/generated/de_liguoro_padovani/future_ref
echo "De'Liguoro & Padovani/Master-worker test"
$(CMD) $(SRC)/examples/erlang/de_liguoro_padovani/master_worker.erl -v all -I include -o $(BIN)
diff $(BIN)/master_worker $(TEST)/generated/de_liguoro_padovani/master_worker_ref
echo "De'Liguoro & Padovani/Sessions test"
$(CMD) $(SRC)/examples/erlang/de_liguoro_padovani/sessions.erl -v all -I include -o $(BIN)
diff $(BIN)/sessions $(TEST)/generated/de_liguoro_padovani/sessions_ref
echo "Savina/Cigarette smokers test"
$(CMD) $(SRC)/examples/erlang/savina/cig_smok.erl -v all -I include -o $(BIN)
diff $(BIN)/cig_smok $(TEST)/generated/savina/cig_smok_ref
echo "Savina/Counter"
$(CMD) $(SRC)/examples/erlang/savina/count.erl -v all -I include -o $(BIN)
diff $(BIN)/count $(TEST)/generated/savina/count_ref
echo "Savina/Fibonacci"
$(CMD) $(SRC)/examples/erlang/savina/fib.erl -v all -I include -o $(BIN)
diff $(BIN)/fib $(TEST)/generated/savina/fib_ref
echo "Savina/Fibonacci (Pairs)"
$(CMD) $(SRC)/examples/erlang/savina/fib_pairs.erl -v all -I include -o $(BIN)
diff $(BIN)/fib_pairs $(TEST)/generated/savina/fib_pairs_ref
echo "Savina/KFork"
$(CMD) $(SRC)/examples/erlang/savina/kfork.erl -v all -I include -o $(BIN)
diff $(BIN)/kfork $(TEST)/generated/savina/kfork_ref
echo "Savina/Dining philosophers"
$(CMD) $(SRC)/examples/erlang/savina/philosopher.erl -v all -I include -o $(BIN)
diff $(BIN)/philosopher $(TEST)/generated/savina/philosopher_ref
echo "Savina/Ping pong"
$(CMD) $(SRC)/examples/erlang/savina/ping_pong.erl -v all -I include -o $(BIN)
diff $(BIN)/ping_pong $(TEST)/generated/savina/ping_pong_ref
echo "Savina/Ping pong (Strict)"
$(CMD) $(SRC)/examples/erlang/savina/ping_pong_strict.erl -v all -I include -o $(BIN)
diff $(BIN)/ping_pong_strict $(TEST)/generated/savina/ping_pong_strict_ref
echo "Savina/Thread ring"
$(CMD) $(SRC)/examples/erlang/savina/thread_ring.erl -v all -I include -o $(BIN)
diff $(BIN)/thread_ring $(TEST)/generated/savina/thread_ring_ref
run: compile
@echo "prog $(RUN_ARGS)"
erl -noshell -pa $(BIN) -eval 'paterl:compile("$(RUN_ARGS)", [{includes,["include"]}])' -s init stop
clean:
rm -rf $(BIN)/*.beam $(BIN)/*.E $(BIN)/*.tmp erl_crash.dump $(BIN)/*.app