PROJECT_NAME := pqready
BINARY_NAME := pqready
VERSION := $(shell grep '^version =' Cargo.toml | head -n1 | sed 's/version = "\(.*\)"/\1/')
.PHONY: all
all: build
.PHONY: build
build:
@echo "๐จ Building $(PROJECT_NAME) (debug)..."
cargo build
.PHONY: release
release:
@echo "๐ Building $(PROJECT_NAME) (release)..."
cargo build --release
.PHONY: install
install: release
@echo "๐ฆ Installing $(PROJECT_NAME)..."
cargo install --path .
.PHONY: test
test:
@echo "๐งช Running tests..."
cargo test
.PHONY: test-verbose
test-verbose:
@echo "๐งช Running tests (verbose)..."
cargo test -- --nocapture
.PHONY: check
check:
@echo "๐ Checking code..."
cargo check
.PHONY: clippy
clippy: clippy-all
.PHONY: clippy-all
clippy-all:
@echo "๐ Running clippy (all targets and features)..."
cargo clippy --all-targets --all-features -- -D warnings
.PHONY: fmt
fmt:
@echo "๐จ Formatting code..."
cargo fmt
.PHONY: fmt-check
fmt-check:
@echo "๐จ Checking code formatting..."
cargo fmt -- --check
.PHONY: fmt-md
fmt-md:
@echo "๐ Formatting markdown files..."
@which prettier > /dev/null 2>&1 || { echo "Installing prettier..."; npm install -g prettier; }
prettier --write "*.md" "**/*.md" --ignore-path .gitignore
.PHONY: fmt-md-check
fmt-md-check:
@echo "๐ Checking markdown formatting..."
@which prettier > /dev/null 2>&1 || { echo "Installing prettier..."; npm install -g prettier; }
prettier --check "*.md" "**/*.md" --ignore-path .gitignore
.PHONY: fmt-all
fmt-all: fmt fmt-md
@echo "โ
All formatting complete!"
.PHONY: fmt-all-check
fmt-all-check: fmt-check fmt-md-check
@echo "โ
All formatting checks complete!"
.PHONY: run
run:
@echo "๐ Running $(PROJECT_NAME) with example..."
cargo run -- https://example.com
.PHONY: run-verbose
run-verbose:
@echo "๐ Running $(PROJECT_NAME) with verbose output..."
cargo run -- -v https://github.com
.PHONY: run-json
run-json:
@echo "๐ Running $(PROJECT_NAME) with JSON output..."
cargo run -- -j https://google.com
.PHONY: run-deep
run-deep:
@echo "๐ฌ Running $(PROJECT_NAME) with deep analysis (default)..."
cargo run -- -v https://github.com
.PHONY: run-regular
run-regular:
@echo "๐ง Running $(PROJECT_NAME) with regular analysis (high-level)..."
cargo run -- --regular -v https://github.com
.PHONY: run-deep-json
run-deep-json:
@echo "๐ฌ Running $(PROJECT_NAME) with deep analysis (JSON)..."
cargo run -- -j https://github.com
.PHONY: clean
clean:
@echo "๐งน Cleaning build artifacts..."
cargo clean
.PHONY: update
update:
@echo "โฌ๏ธ Updating dependencies..."
cargo update
.PHONY: audit
audit:
@echo "๐ Auditing dependencies for security vulnerabilities..."
@which cargo-audit > /dev/null 2>&1 || { echo "Installing cargo-audit..."; cargo install cargo-audit --locked; }
cargo audit --ignore yanked
.PHONY: audit-fix
audit-fix:
@echo "๐ง Auditing dependencies and updating to fix vulnerabilities..."
@which cargo-audit > /dev/null 2>&1 || { echo "Installing cargo-audit..."; cargo install cargo-audit --locked; }
cargo update
cargo audit --ignore yanked
.PHONY: doc
doc:
@echo "๐ Building documentation..."
cargo doc --no-deps
.PHONY: doc-open
doc-open:
@echo "๐ Building and opening documentation..."
cargo doc --no-deps --open
.PHONY: strip
strip: release
@echo "๐ช Stripping release binary..."
strip target/release/$(BINARY_NAME)
.PHONY: size
size: release
@echo "๐ Binary size information:"
@ls -lh target/release/$(BINARY_NAME)
@file target/release/$(BINARY_NAME)
.PHONY: publish-check
publish-check:
@echo "๐ Checking if ready to publish..."
cargo publish --dry-run
.PHONY: publish-check-dirty
publish-check-dirty:
@echo "๐ Checking if ready to publish (allowing dirty git)..."
cargo publish --dry-run --allow-dirty
.PHONY: publish
publish: ci publish-check
@echo "๐ฆ Publishing $(PROJECT_NAME) to crates.io..."
@echo "โ ๏ธ This will publish version $(VERSION) to crates.io!"
@echo "โ ๏ธ Make sure all changes are committed to git first!"
@echo "Press Ctrl+C to cancel, or Enter to continue..."
@read
cargo publish
.PHONY: publish-dirty
publish-dirty: ci publish-check-dirty
@echo "๐ฆ Publishing $(PROJECT_NAME) to crates.io (dirty git allowed)..."
@echo "โ ๏ธ This will publish version $(VERSION) to crates.io!"
@echo "โ ๏ธ WARNING: Publishing with uncommitted changes!"
@echo "Press Ctrl+C to cancel, or Enter to continue..."
@read
cargo publish --allow-dirty
.PHONY: dev
dev: fmt fmt-md clippy-all test audit build
.PHONY: ci
ci: fmt-check fmt-md-check clippy-all test audit build
.PHONY: security
security: audit
@echo "โ
Security audit completed successfully"
.PHONY: demo
demo: build
@echo "๐ฌ Running demo sequence..."
@echo "\n=== Testing Google ==="
cargo run -- https://google.com
@echo "\n=== Testing GitHub (verbose) ==="
cargo run -- -v https://github.com
@echo "\n=== Testing Cloudflare (JSON) ==="
cargo run -- -j https://cloudflare.com
.PHONY: demo-deep
demo-deep: build
@echo "๐ฌ Running analysis demo sequence (deep is default)..."
@echo "\n=== Deep Analysis: GitHub (default behavior) ==="
cargo run -- -v https://github.com
@echo "\n=== Deep Analysis: Google ==="
cargo run -- -v https://google.com
@echo "\n=== Regular vs Deep Analysis Comparison ==="
@echo "--- Regular Analysis (high-level) ---"
cargo run -- --regular -v https://github.com
@echo "--- Deep Analysis (default) ---"
cargo run -- -v https://github.com
.PHONY: help
help:
@echo "$(PROJECT_NAME) v$(VERSION) - Quantum Security Scanner"
@echo ""
@echo "Available targets:"
@echo " build Build debug version"
@echo " release Build optimized release version"
@echo " install Install binary to system"
@echo " test Run tests"
@echo " test-verbose Run tests with verbose output"
@echo " check Check code without building"
@echo " clippy Run clippy linter"
@echo " clippy-all Run clippy linter (all targets and features)"
@echo " fmt Format code"
@echo " fmt-check Check code formatting"
@echo " fmt-md Format markdown files"
@echo " fmt-md-check Check markdown formatting"
@echo " fmt-all Format both code and markdown"
@echo " fmt-all-check Check both code and markdown formatting"
@echo " run Run with example URL"
@echo " run-verbose Run with verbose output"
@echo " run-json Run with JSON output"
@echo " run-deep Run with deep analysis (default behavior)"
@echo " run-regular Run with regular high-level analysis"
@echo " run-deep-json Run with deep analysis (JSON output)"
@echo " clean Clean build artifacts"
@echo " update Update dependencies"
@echo " audit Audit dependencies for vulnerabilities"
@echo " audit-fix Audit dependencies and fix vulnerabilities"
@echo " security Run complete security audit"
@echo " doc Build documentation"
@echo " doc-open Build and open documentation"
@echo " strip Strip release binary (reduce size)"
@echo " size Show binary size information"
@echo " publish-check Check if package is ready to publish (dry-run)"
@echo " publish Publish to crates.io (runs CI checks first)"
@echo " publish-check-dirty Check if ready to publish (allow dirty git)"
@echo " publish-dirty Publish to crates.io (allow dirty git, for development)"
@echo " dev Development workflow (fmt + clippy + test + build)"
@echo " ci CI workflow (fmt-check + clippy + test + build)"
@echo " demo Run demo with multiple URLs"
@echo " demo-deep Run deep analysis demo (showcases TLS handshake inspection)"
@echo " help Show this help message"
@echo ""
@echo "Examples:"
@echo " make build @echo " make release @echo " make fmt-md @echo " make demo @echo " make demo-deep @echo " make dev @echo " make publish-check @echo " make publish @echo ""
@echo "Direct binary usage:"
@echo " ./target/release/pqready https://example.com"
@echo " ./target/release/pqready -v https://github.com"
@echo " ./target/release/pqready -j https://google.com"
@echo " ./target/release/pqready --regular -v https://github.com @echo ""
@echo "Note: Deep analysis is the default behavior (best quantum detection)."
@echo "Use --regular for high-level analysis (limited quantum detection)."