-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
66 lines (41 loc) · 960 Bytes
/
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
###############################
# Common defaults/definitions #
###############################
comma := ,
# Checks two given strings for equality.
eq = $(if $(or $(1),$(2)),$(and $(findstring $(1),$(2)),\
$(findstring $(2),$(1))),1)
OS_NAME := $(shell uname -s)
###########
# Aliases #
###########
check: fmt lint doc
fmt: cargo.fmt
lint: cargo.lint
doc: cargo.doc
##################
# Cargo commands #
##################
# Format Rust sources with rustfmt.
#
# Usage:
# make cargo.fmt [check=(no|yes)]
cargo.fmt:
cargo +nightly fmt --all $(if $(call eq,$(check),yes),-- --check,)
# Lint Rust sources with Clippy.
#
# Usage:
# make cargo.lint
cargo.lint:
cargo clippy --all -- -D clippy::pedantic -D warnings
# Generate Rust docs.
#
# Usage:
# make cargo.doc
cargo.doc:
cargo doc --all-features
##################
# .PHONY section #
##################
.PHONY: fmt lint \
cargo.fmt cargo.lint