-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
130 lines (99 loc) · 3.09 KB
/
Makefile
File metadata and controls
130 lines (99 loc) · 3.09 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
123
124
125
126
127
128
129
130
# http://www.gnu.org/software/make/manual/make.html#Special-Variables
.DEFAULT_GOAL := release
# http://www.gnu.org/software/make/manual/make.html#Phony-Targets
.PHONY: clean docker
TARGET_DIR = target
DEBUG_DIR = $(TARGET_DIR)/debug
RELEASE_DIR = $(TARGET_DIR)/release
RLS_DIR = $(TARGET_DIR)/rls
INSTALL_DIR = /usr/local/bin
BINARY = mpn
all: fmt test clean
fmt:
cargo fmt --all --verbose
fmt-check:
cargo fmt --all -- --check
debug:
export RUSTFLAGS=""
cargo build
release: test
cargo build --release
test: # see https://doc.rust-lang.org/book/ch11-02-running-tests.html
cargo test -- --test-threads=1
test-all:
cargo test --verbose --all -- --nocapture
example:
cargo run --example simple
dev-install-tools: cargo-install-tools python-install-tools
cargo-install-tools:
cargo install cargo-bloat
cargo install cargo-deb
cargo install cargo-geiger
cargo install cargo-trend
cargo install cargo-show
cargo install cargo-outdated
cargo install cargo-edit
cargo install hyperfine
cargo install --list
python-install-tools:
pip install codespell
npm-install-tools:
npm install markdownlint-cli2 --global
publish-dry-run:
cargo publish --dry-run
cargo package --list
geiger:
cargo geiger
tarpaulin:
# use docker as tarpaulin only supports x86_64 processors running linux
docker run --security-opt seccomp=unconfined -v "${PWD}:/volume" xd009642/tarpaulin
open tarpaulin-report.html
grcov:
# grcov requires rust nightly for now
rm -rf target/debug/
# export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off"
export CARGO_INCREMENTAL=0 && \
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" && \
export RUSTDOCFLAGS="-Cpanic=abort" && \
cargo +nightly build
cargo +nightly test --verbose
grcov ./target/debug/ -s . -t html --llvm --branch --ignore-not-existing -o ./target/debug/coverage/
open target/debug/coverage/index.html
install: release debug test
cargo install --path .
## cp $(RELEASE_DIR)/$(BINARY) $(INSTALL_DIR)/$(BINARY)
install-force: clean release debug test
cargo install --path . --force
clippy:
cargo clippy
docker-build:
docker build -t sitkevij/mpn:latest .
docker-run:
docker run -i sitkevij/mpn:latest
deb:
cargo deb
manpage:
target/debug/mpn --help >target/debug/mpn.1.txt
pandoc MANPAGE.md -s -t man
HELP=$(cat target/debug/mpn.1.txt)
echo "$HELP"
MANPAGE=$(cat MANPAGE.md)
# echo $MANPAGE | sed 's/$/\\n/g' | tr -d'\n'
pandoc --standalone --to man MANPAGE.md -o mpn.1
cp mpn.1 /usr/local/share/man/man1
man mpn
lint: lint-clippy lint-format lint-markdown lint-spell
lint-clippy:
cargo clippy --workspace --all-targets --verbose
cargo clippy --workspace --all-targets --verbose --no-default-features
cargo clippy --workspace --all-targets --verbose --all-features
lint-format:
cargo fmt --all -- --check
lint-markdown:
markdownlint-cli2 --config .markdownlint.json *.md
lint-spell:
codespell -L crate -w src/*.rs *.md tests/*.rs *.toml
clean: ## Remove all artifacts
rm -rf $(DEBUG_DIR)
rm -rf $(RELEASE_DIR)
rm -rf $(RLS_DIR)