ERROR := \x1b[0;91m
INFO := \x1b[0;94m
NC := \x1b[0m
define show_help_message
echo "Usage: make TARGET"
echo ""
echo "Commands:"
grep -hE '^[A-Za-z0-9_ \-]*?:.*##.*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " $(INFO)%-12s$(NC) %s\n", $$1, $$2}'
endef
define show_error_message
echo "$(ERROR)[Error] $(1)$(NC)"
endef
PREFIX ?= /usr/local
.PHONY: all
all: build
.PHONY: help
help:
@$(show_help_message)
.PHONY: clean
clean:
@cargo clean
.PHONY: r
r: run
.PHONY: run
run:
@cargo run --quiet --all-features
.PHONY: b
b: build
.PHONY: build
build:
@cargo build --release --all-features
.PHONY: l
l: lint
.PHONY: lint
lint:
@pre-commit run --all-files
.PHONY: check
check:
@rustup update
@cargo fmt
@cargo doc --no-deps --all-features
@cargo check
@cargo clippy --all-targets --all-features -- -D warnings -W clippy::all -W clippy::cargo -W clippy::complexity -W clippy::correctness -W clippy::nursery -W clippy::pedantic -W clippy::perf -W clippy::style -W clippy::suspicious -A clippy::missing-const-for-fn -A clippy::option-if-let-else -A clippy::suboptimal_flops
@make test
@make coverage-pct
.PHONY: t
t: test
.PHONY: test
test:
@cargo test --all-features
.PHONY: doc
doc:
@cargo doc --all-features --document-private-items
@echo file://$(shell pwd)/target/doc/moontool/index.html
.PHONY: c
c: coverage
.PHONY: coverage
coverage:
@cargo tarpaulin --engine Llvm --timeout 120 --skip-clean --out Html --output-dir target/ --all-features
@echo file://$(shell pwd)/target/tarpaulin-report.html
.PHONY: cpc
cpc: coverage-pct
.PHONY: coverage-pct
coverage-pct:
@cargo tarpaulin --engine Llvm --timeout 120 --out Stdout --all-features --fail-under 99
.PHONY: ci-bin-name
ci-bin-name:
@echo "moontool"
.PHONY: install
install:
install -d $(PREFIX)/bin/
install ./target/release/moontool $(PREFIX)/bin/moontool