.PHONY: all test static docs tools tool_rust tool_fmt tool_readme
SHELL = /usr/bin/env sh
all: test
test: static tools
RUST_BACKTRACE=1 cargo build --all-features --all-targets
RUST_BACKTRACE=1 cargo test --all-features -- --test-threads 1
static: docs tools
cargo fmt -- --check
cargo clippy
docs: tools
printf '### The `tx3-relay` executable\n`tx3-relay --help`\n```text\n' > src/docs/tx3_relay_help.md
cargo run -- --help >> src/docs/tx3_relay_help.md
printf '\n```\n' >> src/docs/tx3_relay_help.md
cargo readme -o README.md
printf '\n' >> README.md
cat src/docs/tx3_relay_help.md >> README.md
@if [ "${CI}x" != "x" ]; then git diff --exit-code; fi
tools: tool_rust tool_fmt tool_clippy tool_readme
tool_rust:
@if rustup --version >/dev/null 2>&1; then \
echo "# Makefile rustup override set stable; \
else \
echo "# Makefile fi;
tool_fmt: tool_rust
@if ! (cargo fmt --version); \
then \
if rustup --version >/dev/null 2>&1; then \
echo "# Makefile rustup component add rustfmt; \
else \
echo "# Makefile exit 1; \
fi; \
else \
echo "# Makefile fi;
tool_clippy: tool_rust
@if ! (cargo clippy --version); \
then \
if rustup --version >/dev/null 2>&1; then \
echo "# Makefile rustup component add clippy; \
else \
echo "# Makefile exit 1; \
fi; \
else \
echo "# Makefile fi;
tool_readme: tool_rust
@if ! (cargo readme --version); \
then \
cargo install cargo-readme; \
else \
echo "# Makefile fi;