ifndef NO_COLOR
BOLD := \033[1m
CYAN := \033[36m
GREEN := \033[32m
YELLOW := \033[33m
RESET := \033[0m
endif
.DEFAULT_GOAL := help
.PHONY: help build test lint fmt fmt-check doc check clean install
help:
@printf "$(BOLD)ytdown$(RESET) — workspace targets\n\n"
@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "} {printf " $(CYAN)%-10s$(RESET) %s\n", $$1, $$2}'
build:
@printf "$(YELLOW)▶ build$(RESET) cargo build --workspace --all-features\n"
@cargo build --workspace --all-features
@printf "$(GREEN)✓ build$(RESET)\n"
test:
@printf "$(YELLOW)▶ test$(RESET) cargo test --workspace --all-features\n"
@cargo test --workspace --all-features
@printf "$(GREEN)✓ test$(RESET)\n"
lint:
@printf "$(YELLOW)▶ lint$(RESET) cargo clippy --workspace --all-targets --all-features -- -D warnings\n"
@cargo clippy --workspace --all-targets --all-features -- -D warnings
@printf "$(GREEN)✓ lint$(RESET)\n"
fmt:
@printf "$(YELLOW)▶ fmt$(RESET) cargo fmt --all\n"
@cargo fmt --all
@printf "$(GREEN)✓ fmt$(RESET)\n"
fmt-check:
@printf "$(YELLOW)▶ fmt-check$(RESET) cargo fmt --all -- --check\n"
@cargo fmt --all -- --check
@printf "$(GREEN)✓ fmt-check$(RESET)\n"
doc:
@printf "$(YELLOW)▶ doc$(RESET) cargo doc --workspace --no-deps --all-features\n"
@cargo doc --workspace --no-deps --all-features
@printf "$(GREEN)✓ doc$(RESET)\n"
check: fmt-check lint test
@printf "$(GREEN)✓ check — all gates passed$(RESET)\n"
install:
@printf "$(YELLOW)▶ install$(RESET) cargo install --path cli\n"
@cargo install --path cli
@printf "$(GREEN)✓ install$(RESET)\n"
clean:
@printf "$(YELLOW)▶ clean$(RESET) cargo clean\n"
@cargo clean
@printf "$(GREEN)✓ clean$(RESET)\n"