.PHONY: help
help:
@echo "Available targets:"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: check
check:
@echo "==> Checking server..."
@cargo check
.PHONY: fmt
fmt:
@cargo fmt --all
.PHONY: fmt-check
fmt-check:
@cargo fmt --all -- --check
.PHONY: clippy
clippy:
@echo "==> Clippy server..."
@cargo clippy --all-targets -- -D warnings
.PHONY: test
test:
@echo "==> Testing server..."
@cargo test
.PHONY: test-verbose
test-verbose:
@cargo test -- --nocapture
.PHONY: build
build:
@echo "==> Building server..."
@cargo build
.PHONY: build-release
build-release:
@echo "==> Building server (release)..."
@cargo build --release
.PHONY: build-server
build-server:
@cargo build --release
.PHONY: build-cli
build-cli:
@echo "==> Building otlp2parquet CLI binary..."
@cargo build --release --bin otlp2parquet
@echo "==> Binary available at: target/release/otlp2parquet"
.PHONY: install-cli
install-cli: build-cli
@echo "==> Installing otlp2parquet to /usr/local/bin..."
@cp target/release/otlp2parquet /usr/local/bin/
@echo "==> Installed successfully. Run 'otlp2parquet --help' to get started."
.PHONY: run-cli
run-cli:
@cargo run --bin otlp2parquet
.PHONY: clean-wasm-demo
clean-wasm-demo:
@rm -rf docs/query-demo/wasm
@echo "Cleaned demo WASM artifacts"
.PHONY: clean
clean:
@cargo clean
@echo "Cleaned all build artifacts"
.PHONY: pre-commit
pre-commit: fmt clippy test
.PHONY: ci
ci: fmt-check clippy test build-release
.PHONY: dev
dev: check test
.PHONY: doc
doc:
@cargo doc --no-deps
.PHONY: doc-open
doc-open:
@cargo doc --no-deps --open
.PHONY: install-tools
install-tools:
@echo "==> Installing Rust toolchain..."
@rustup toolchain install stable
@rustup component add rustfmt clippy
@echo "==> Installing uv (Python package manager)..."
@curl -LsSf https://astral.sh/uv/install.sh | sh
@echo "==> Installing DuckDB (for smoke tests)..."
@if command -v duckdb >/dev/null 2>&1; then \
echo "duckdb already installed."; \
elif command -v brew >/dev/null 2>&1; then \
brew install duckdb; \
else \
echo "Please install DuckDB manually:"; \
echo " Linux: wget https://github.com/duckdb/duckdb/releases/latest/download/duckdb_cli-linux-amd64.zip && unzip duckdb_cli-linux-amd64.zip && sudo mv duckdb /usr/local/bin/"; \
echo " macOS: brew install duckdb"; \
fi
@echo "==> Setting up pre-commit hooks..."
@uvx pre-commit install
@echo "==> All tools installed!"
.PHONY: version
version:
@echo "Rust toolchain:"
@rustc --version
@cargo --version
@echo ""
@echo "Components:"
@rustfmt --version 2>/dev/null || echo "rustfmt: not installed"
@cargo clippy --version 2>/dev/null || echo "clippy: not installed"
@echo ""
@echo "Data tools:"
@duckdb --version 2>/dev/null || echo "duckdb: not installed"
.PHONY: audit
audit:
@cargo audit || (echo "cargo-audit not installed. Install with: cargo install cargo-audit" && exit 1)
.PHONY: publish-dry-run
publish-dry-run:
@echo "==> Dry-run publishing crate to crates.io..."
@cargo publish --dry-run
.PHONY: publish
publish:
@echo "==> Publishing crate to crates.io..."
@cargo publish
.PHONY: bloat
bloat:
@echo "==> Analyzing binary size (top 20)..."
@if ! command -v cargo-bloat >/dev/null 2>&1; then \
echo "Installing cargo-bloat..."; \
cargo install cargo-bloat; \
fi
@cargo bloat --release -n 20 | tee bloat.txt
@echo "==> Results saved to: bloat.txt"
.PHONY: llvm-lines
llvm-lines:
@echo "==> Analyzing LLVM IR line counts..."
@if ! command -v cargo-llvm-lines >/dev/null 2>&1; then \
echo "Installing cargo-llvm-lines..."; \
cargo install cargo-llvm-lines; \
fi
@cargo llvm-lines --release | head -50 | tee llvm_lines.txt
@echo "==> Results saved to: llvm_lines.txt"
.PHONY: profile-all
profile-all: bloat llvm-lines
@echo "==> All profiling complete!"
@echo " - Binary size: bloat.txt"
@echo " - LLVM lines: llvm_lines.txt"
.PHONY: test-smoke
test-smoke:
@echo "==> Running server smoke tests..."
@cargo test --test smoke --features smoke-server -- --test-threads=1
.PHONY: smoke-server
smoke-server:
@echo "==> Checking for DuckDB..."
@if ! command -v duckdb >/dev/null 2>&1; then \
echo "ERROR: DuckDB not found. Install it:"; \
echo " macOS: brew install duckdb"; \
echo " Linux: wget https://github.com/duckdb/duckdb/releases/latest/download/duckdb_cli-linux-amd64.zip && unzip duckdb_cli-linux-amd64.zip && sudo mv duckdb /usr/local/bin/"; \
exit 1; \
fi
@echo "==> Running server smoke tests (plain Parquet)..."
@cargo test --test smoke --features smoke-server -- --test-threads=1
.PHONY: smoke-server-verbose
smoke-server-verbose:
@echo "==> Running server smoke tests (verbose mode)..."
cargo test --test smoke --features smoke-server -- --nocapture
.PHONY: test-all
test-all: test smoke-server
.PHONY: test-full
test-full: test smoke-server