.DEFAULT_GOAL := build binname ?= $(shell tq -o json Cargo.toml | jq -r '.package.name') build_target := $(shell tq -o json .cargo/config.toml | jq -r '.build.target') .PHONY: build build: target/$(build_target)/doc cargo build .PHONY: install install: target/$(build_target)/release/$(binname) sudo install -Dm0755 $< /usr/local/bin .PHONY: test test: cargo test -- --nocapture target/$(build_target)/release/$(binname): src/** Cargo.* cargo build --release target/$(build_target)/doc: Cargo.* cargo doc README.md: Cargo.* src/** buildd truncate -s 0 $@ echo -e "# $(binname)\n" >> $@ echo -e '```' >> $@ cargo run -- --help >> $@ echo -e '```\n' >> README.md .PHONY: lint lint: cargo +nightly clippy -- -Wclippy::pedantic .PHONY: fix fix: cargo +nightly clippy --allow-staged --fix -- -Dclippy::pedantic .PHONY: upgrade upgrade: cargo upgrade --incompatible .PHONY: publish publish: cargo publish --dry-run verto cargo publish git push