.DEFAULT_GOAL := build

t ?=

.PHONY: build
build: target/doc
	cargo build

.PHONY: test
test: target
	cargo test --no-fail-fast $(t) -- --nocapture

target/doc: Cargo.* src/*.rs
	cargo doc

.PHONY: install
install:
	cargo build -F cli --release
	sudo install -Dm0755 \
		target/release/s3ueeze /usr/local/bin

.PHONY: publish
publish: target
	cargo publish --dry-run
	verto
	cargo publish
	echo "Remember to git push!" 1>&2

.PHONY: lint
lint:
	cargo +nightly clippy -- -Wclippy::pedantic

.PHONY: fix
fix:
	cargo +nightly clippy --fix --allow-dirty -- -Wclippy::pedantic
	cargo fmt

.PHONY: upgrade
upgrade:
	cargo upgrade --incompatible
