.PHONY: all docs build release lint test test_cargo test_python clean run_server run_client
all: test release
docs:
@echo "Analyzing Cargo module..."
@./utils/docs-generate-cargo-modules-tree.sh
@echo "Render GraphViz graphs for Docs."
@./utils/render-diagrams.sh ./docs/*.dot
build:
@echo "Building Cargo project (debug mode)..."
@cargo build $(ARGS)
release:
@echo "Building Cargo project (release mode)..."
@cargo build --release $(ARGS)
@ls -lh target/release
lint:
@echo "Running Rust linter (cargo clippy)..."
@cargo clippy --all-targets --all-features -- -D warnings
@echo "Running Python code formatter check (black) on utils and tests..."
@if command -v black >/dev/null 2>&1; then \
black --check utils/*.py; \
else \
echo "Black is not installed. Skipping Python formatting check."; \
fi
lint_fix:
@echo "Running cargo fix to automatically apply Rust suggestions..."
@cargo fix --allow-dirty --allow-staged
@echo "Running black to auto-format Python files in utils and tests..."
@if command -v black >/dev/null 2>&1; then \
black utils/*.py; \
else \
echo "Black is not installed. Skipping Python formatting fix."; \
fi
test: test_cargo test_python test_bats
test_bats:
@echo "Running BATS tests..."
@bats tests/ $(ARGS)
test_cargo:
@echo "Running Cargo tests..."
@cargo test $(ARGS)
test_cargo_debug:
@echo "Running Cargo tests..."
@RUST_BACKTRACE=full RUST_LOG=tracing=debug cargo test $(ARGS)
test_python:
@echo "Running Python unit tests (Data Cruncher)..."
@cd utils && python -m unittest test_cst_datacruncher.py
@echo "Running Python unit tests (Connection Stress Test)..."
@cd utils && python -m unittest test_connection_stress_test.py
clean:
@echo "Cleaning build artifacts..."
@cargo clean
run_server:
@echo "Running portredirect_server, local port 1234 ..."
@cargo run --bin portredirect_server -- --quic-cert-hostname 127.0.0.1 --local-host 127.0.0.1 --local-port 1234 --quic-psk foo $(ARGS)
run_client:
@echo "Running portredirect_client, destination port 2222 ..."
@cargo run --bin portredirect_client -- --destination-host 127.0.0.1 --destination-port 2222 --quic-remote-host 127.0.0.1 --quic-remote-port 4433 --quic-psk foo $(ARGS)