forked from priestjim/gen_rpc
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
100 lines (69 loc) · 2.57 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
#
# Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
# Copyright 2015 Panagiotis Papadomitsos. All Rights Reserved.
#
# .DEFAULT_GOAL can be overridden in custom.mk if "all" is not the desired
# default
.DEFAULT_GOAL := all
# Build targets
.PHONY: all test dialyzer xref spec dist travis
# Run targets
.PHONY: shell shell-master shell-slave
# Misc targets
.PHONY: clean testclean distclean tags rebar docker docker-test docker-test-ssl docker-test-ipv6 docker-test-ipv6-ssl
PROJ = $(shell ls -1 src/*.src | sed -e 's/src//' | sed -e 's/\.app\.src//' | tr -d '/')
TYPER = $(shell which typer)
REBAR = rebar3
OTP_RELEASE = $(shell escript otp-release.escript)
PLT_FILE = $(CURDIR)/_plt/rebar3_$(OTP_RELEASE)_plt
# ============================
# Integration test with docker
# ============================
DOCKER_IMAGE ?= genrpc
docker:
@docker build --network host --pull -t $(DOCKER_IMAGE) .
NODES ?= 3
docker-test: docker
@./test/integration/integration-tests.sh $(NODES)
docker-test-ssl: docker
@env LISTEN="0.0.0.0" SSL=true ./test/integration/integration-tests.sh $(NODES)
docker-test-ipv6: docker
@env LISTEN="::" ./test/integration/integration-tests.sh $(NODES)
docker-test-ipv6-ssl: docker
@env LISTEN="::" SSL=true ./test/integration/integration-tests.sh $(NODES)
docker-cluster: docker
@./test/integration/integration-tests.sh $(NODES) false
# =============================================================================
# Build targets
# =============================================================================
all:
$(REBAR) compile
test: epmd
@REBAR_PROFILE=test $(REBAR) do eunit, ct --name [email protected] --cover, cover
dialyzer: $(PLT_FILE)
@$(REBAR) do compile, dialyzer
xref:
@$(REBAR) xref
spec: dialyzer
@$(TYPER) --annotate-inc-files -I ./include --plt $(PLT_FILE) -r src/
dist: test
@$(REBAR) do dialyzer, xref
# =============================================================================
# Misc targets
# =============================================================================
clean: $(REBAR)
@$(REBAR) clean
@rm -f rebar.lock
distclean: $(REBAR)
@rm -rf _build _plt .rebar Mnesia* mnesia* data/ temp-data/ rebar.lock
@find . -name erl_crash.dump -type f -delete
@$(REBAR) clean -a
testclean:
@rm -fr _build/test && rm -rf ./test/*.beam
@find log/ct -maxdepth 1 -name ct_run* -type d -cmin +360 -exec rm -fr {} \; 2> /dev/null || true
epmd:
@pgrep epmd 2> /dev/null > /dev/null || epmd -daemon || true
tags:
find src _build/default/lib -name "*.[he]rl" -print | etags -
$(PLT_FILE):
@$(REBAR) do dialyzer || true