.PHONY: all build test fmt clean run check lint help parse validate emit-js emit-html coverage
all: build
build:
cargo build
release:
cargo build --release
test:
cargo test
test-verbose:
cargo test -- --nocapture
fmt:
cargo fmt
fmt-check:
cargo fmt --check
lint:
cargo clippy -- -D warnings
check:
cargo check
clean:
cargo clean
run:
cargo run --bin webnn-graph -- parse examples/resnet_head.webnn
parse:
cargo run --bin webnn-graph -- parse examples/resnet_head.webnn
validate:
cargo run --bin webnn-graph -- parse examples/resnet_head.webnn > /tmp/graph.json && \
cargo run --bin webnn-graph -- validate /tmp/graph.json --weights-manifest examples/weights.manifest.json
emit-js:
cargo run --bin webnn-graph -- parse examples/resnet_head.webnn > /tmp/graph.json && \
cargo run --bin webnn-graph -- emit-js /tmp/graph.json
emit-html:
cargo run --bin webnn-graph -- emit-html examples/resnet_head.webnn > /tmp/webnn_viz.html
@echo "Visualizer generated: /tmp/webnn_viz.html"
@echo "Open it with: open /tmp/webnn_viz.html"
coverage:
@if command -v cargo-tarpaulin >/dev/null 2>&1; then \
cargo tarpaulin --out Html --output-dir coverage; \
echo "Coverage report generated in coverage/"; \
else \
echo "cargo-tarpaulin not installed. Install with: cargo install cargo-tarpaulin"; \
exit 1; \
fi
dev-deps:
@echo "Installing development dependencies..."
@command -v cargo-tarpaulin >/dev/null 2>&1 || cargo install cargo-tarpaulin
@echo "Development dependencies installed"
help:
@echo "WebNN Graph - Available Make Targets:"
@echo ""
@echo " make build - Build the project"
@echo " make release - Build with release optimizations"
@echo " make test - Run all tests"
@echo " make test-verbose - Run tests with output"
@echo " make fmt - Format code"
@echo " make fmt-check - Check code formatting"
@echo " make lint - Run clippy linter"
@echo " make check - Quick compile check"
@echo " make clean - Clean build artifacts"
@echo " make run - Run CLI with example"
@echo " make parse - Parse example graph"
@echo " make validate - Validate example graph"
@echo " make emit-js - Emit JavaScript for example"
@echo " make emit-html - Generate HTML visualizer for example"
@echo " make coverage - Generate test coverage report"
@echo " make dev-deps - Install development dependencies"
@echo " make help - Show this help message"