forked from ubnt-intrepid/dot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
72 lines (59 loc) · 1.54 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
TARGETS=armv7-unknown-linux-gnueabihf aarch64-unknown-linux-gnu riscv64gc-unknown-linux-gnu x86_64-unknown-linux-gnu
# TODO: Can only compile for apple on OSX
# x86_64-apple-darwin
.PHONY: all
all: format build lint test
.PHONY: bootstrap
bootstrap:
rustup update
cargo install cross
cargo install cargo-deb
.PHONY: clean
clean:
cargo clean
.PHONY: format
format:
RUST_LOG=error; cargo fmt
.PHONY: lint
lint:
cargo fmt --all -- --check
# Sadly the clippy team can't seem to figure out how to allow enabling/disabling lints in their config file (https://github.com/rust-lang/cargo/issues/5034)
# So we have to do it with CLI flags.
cargo clippy -- --deny warnings #-D clippy::unwrap_used
cargo clippy --tests -- --deny warnings -A clippy::unwrap_used
.PHONY: build
build:
cargo build
.PHONY: test
test:
# Use --all-targets to ensure that all of the benchmarks compile.
RUST_BACKTRACE=1 cargo test --all-targets
# Amazingly, `--all-targets` causes doc-tests not to run.
RUST_BACKTRACE=1 cargo test --doc
.PHONY: cross
cross:
for target in $(TARGETS); do \
cross build --target $$target ; \
done
.PHONY: cross-test
cross-test:
for target in $(TARGETS); do \
cross test --target $$target ; \
done
.PHONY: cross-release
cross-release:
set -ex && \
for target in $(TARGETS); do \
cross build --release --target $$target ; \
done
.PHONY: install
install:
cargo install
.PHONY: build-release
build-release:
cargo build --release
.PHONY: deb
deb:
for target in $(TARGETS); do \
cargo deb --no-build --no-strip --target $$target ; \
done