DEFAULT_GOAL := all
binname ?= $(shell rg 'name = ' Cargo.toml | tr -d '"' | tr -d "'" | awk '{print $$3}')
t :=
.PHONY: all
all: build lint
.PHONY: build
build: target/doc
cargo build --all-targets --all-features
.PHONY: release
release:
cargo build --all-features --release
target/doc: Cargo.*
cargo doc --document-private-items
.PHONY: install
install: release
sudo install -Dm0755 target/release/$(binname) /usr/local/bin
.PHONY: lint
lint: build
cargo fmt --check
cargo +nightly check
cargo +nightly clippy --no-deps --workspace --all-targets --all-features \
-- -Wclippy::pedantic
.PHONY: fix
fix:
cargo +nightly clippy
--no-deps \
--workspace \
--all-targets \
--all-features \
--fix \
--allow-staged \
-- -Wclippy::pedantic
cargo fmt
.PHONY: test
test:
cargo test --all-features --no-fail-fast $(t) -- --nocapture
.PHONY: upgrade
upgrade:
cargo upgrade --incompatible
cargo update
.PHONY: publish
publish: test
cargo publish