-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (97 loc) · 2.15 KB
/
Copy pathMakefile
File metadata and controls
122 lines (97 loc) · 2.15 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -euc
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
## General Rules
all: compile doc
.PHONY: all
.NOTPARALLEL: all
compile:
@rebar3 compile
.PHONY: compile
clean:
@rebar3 clean -a
.PHONY: clean
check: check-fast check-slow
.NOTPARALLEL: check
.PHONY: check
check-fast: check-formatted xref find-unused-code lint
.NOTPARALLEL: check-fast
.PHONY: check-fast
check-slow: dialyzer
.NOTPARALLEL: check-slow
.PHONY: check-slow
test: eunit ct cover
.NOTPARALLEL: test
.PHONY: test
format:
@rebar3 fmt
.NOTPARALLEL: format
.PHONY: format
## Tests
ct:
@rebar3 ct
.PHONY: ct
eunit:
@rebar3 eunit
.PHONY: eunit
cover:
@rebar3 cover
.PHONY: cover
## Checks
check-formatted:
@if rebar3 plugins list | grep '^erlfmt\>' >/dev/null; then \
rebar3 fmt --check; \
else \
echo >&2 "WARN: skipping rebar3 erlfmt check"; \
fi
.PHONY: check-formatted
dialyzer:
@rebar3 as test dialyzer
.PHONY: dialyzer
xref:
@rebar3 as test xref
.PHONY: xref
lint:
@if rebar3 plugins list | grep '^rebar3_lint\>' >/dev/null; then \
rebar3 lint; \
else \
echo >&2 "WARN: skipping rebar3_lint check"; \
fi
.PHONY: lint
find-unused-code:
@if rebar3 plugins list | grep '^rebar3_hank\>' >/dev/null; then \
rebar3 hank; \
else \
echo >&2 "WARN: skipping rebar3_hank check"; \
fi
.PHONY: lint
## Shell, docs and publication
shell: export ERL_FLAGS = +pc unicode
shell:
@rebar3 as test shell
.PHONY: shell
publish: doc
publish:
@rebar3 hex publish --doc-dir=doc
.NOTPARALLEL: publish
doc: SOURCE_REF := $(shell git describe --tags --exact-match 2>/dev/null || git rev-parse --short HEAD)
doc: tmp/ex_doc
doc:
rebar3 as docs edoc; \
./tmp/ex_doc "xb5" "${SOURCE_REF}" \
_build/docs/lib/xb5/ebin \
-c ex_doc.config \
--source-ref "${SOURCE_REF}";
.PHONY: doc
tmp/ex_doc: EX_DOC_VER=0.40.2
tmp/ex_doc: OTP_VER := $(shell erl -noshell -eval 'io:fwrite("~s", [erlang:system_info(otp_release)]), init:stop().')
tmp/ex_doc: | tmp
tmp/ex_doc:
curl -fL -o tmp/ex_doc \
"https://github.com/elixir-lang/ex_doc/releases/download/v${EX_DOC_VER}/ex_doc_otp_${OTP_VER}"; \
chmod a+x tmp/ex_doc
tmp:
mkdir tmp