BIN := recon
RELEASE_BIN := target/release/$(BIN)
DEBUG_BIN := target/debug/$(BIN)
MANUAL_MD := docs/MANUAL.md
MANUAL_PDF := docs/MANUAL.pdf
CARGO ?= cargo
IMPERSONATE := --features impersonate
FEATURES ?=
.DEFAULT_GOAL := help
.PHONY: help build release all check test test-quiet fmt fmt-check clippy lint \
doc run install uninstall clean clean-all distclean size pdf \
flags examples bump-check ci \
build-impersonate release-impersonate all-impersonate \
check-impersonate test-impersonate run-impersonate \
install-impersonate ci-impersonate
help:
@awk 'BEGIN {FS = ":.*##"; printf "Usage: make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-14s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
build:
$(CARGO) build $(FEATURES)
release:
$(CARGO) build --release $(FEATURES)
all: build release
build-impersonate:
$(CARGO) build $(IMPERSONATE)
release-impersonate:
$(CARGO) build --release $(IMPERSONATE)
all-impersonate: build-impersonate release-impersonate
check:
$(CARGO) check --all-targets $(FEATURES)
check-impersonate:
$(CARGO) check --all-targets $(IMPERSONATE)
test:
$(CARGO) test $(FEATURES)
test-impersonate:
$(CARGO) test $(IMPERSONATE)
test-quiet:
$(CARGO) test --quiet $(FEATURES)
fmt:
$(CARGO) fmt --all
fmt-check:
$(CARGO) fmt --all -- --check
clippy:
$(CARGO) clippy --all-targets -- -D warnings
lint: fmt-check clippy
run: ## Run the debug binary (use ARGS="..." to pass arguments)
$(CARGO) run $(FEATURES) -- $(ARGS)
run-impersonate: ## Run the impersonate-feature debug binary (use ARGS="..." to pass arguments)
$(CARGO) run $(IMPERSONATE) -- $(ARGS)
install: release
$(CARGO) install --path . --force $(FEATURES)
install-impersonate: release-impersonate
$(CARGO) install --path . --force $(IMPERSONATE)
uninstall:
$(CARGO) uninstall $(BIN) || true
doc:
$(CARGO) doc --no-deps
pdf: release
$(RELEASE_BIN) --md-to-pdf $(MANUAL_MD) \
--toc --toc-depth 3 --gfm \
--unsafe-html --page-break-on-h1 \
--doc-title 'recon User Manual' \
-o $(MANUAL_PDF)
flags: release
$(RELEASE_BIN) --flags
examples: release
$(RELEASE_BIN) --examples
clean:
$(CARGO) clean
clean-all: clean
rm -rf target/doc dump.rdb
distclean: clean-all
rm -f Cargo.lock
size:
@if [ -d target ]; then \
du -sh target target/debug target/release target/doc 2>/dev/null | sort -hr; \
else \
echo "target/ does not exist"; \
fi
bump-check:
@grep -E '^version' Cargo.toml | head -1
@grep -E 'RELEASE_DATE' src/version.rs | head -1
ci: fmt-check clippy test
ci-impersonate: fmt-check clippy test test-impersonate