forked from Normation/rudder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrust.makefile
73 lines (56 loc) · 1.69 KB
/
rust.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
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-FileCopyrightText: 2019-2020 Normation SAS
.DEFAULT_GOAL := build
SHELL := /bin/bash
PATH := $(PATH):$(HOME)/.cargo/bin:$(PATH)
DEBUGOPT:=$(shell make -v --debug=n >/dev/null2>&1 && echo --debug=n)
APT := apt update && apt install -y --no-install-recommends
YUM := yum install -y
DESTDIR := $(CURDIR)/make_target
REDHATOS := $(wildcard /etc/redhat-release*)
DEBIANOS := $(wildcard /etc/debian_version*)
ifneq ($(DEBIANOS),)
PKG_INSTALLER := $(APT)
else ifneq ($(REDHATOS),)
PKG_INSTALLER := $(YUM)
endif
build-env:
curl https://sh.rustup.rs -sSf | sh -s -- -y
rustup component add clippy
cargo install cargo-update
cargo install cargo-audit
build-env-update:
rustup self update
rustup update
cargo install-update -a
version:
cargo --version
rustc --version
build: version
# strip release binaries, cf. https://github.com/rust-lang/cargo/issues/3483#issuecomment-431209957
# should be configurable in Cargo.toml in the future https://github.com/rust-lang/cargo/issues/3483#issuecomment-631584439
RUSTFLAGS="--codegen link-arg=-Wl,--strip-all" cargo build --release
lint: version
RUSTFLAGS="-D warnings" cargo check --all-targets --examples --tests
cargo clippy --all-targets --examples --tests
check: lint
cargo test
cargo audit
clean:
cargo clean
rm -rf target
veryclean: clean
rustup self uninstall
rm -rf ~/.rustup ~/.cargo
outdated:
# only check on our dependencies
cargo outdated --root-deps-only
deps-update: update outdated
[ -d fuzz ] && cd fuzz && cargo update
dev-env: build-env
rustup component add rustfmt
cargo install cargo-outdated
cargo install tokei
stats:
@ echo -n "TODOS: " && grep -r TODO src | wc -l
@ tokei