.PHONY: all examples static-examples interactive-examples performance-examples web-examples clean help setup-hooks check fmt clippy doc-images
all: examples
examples: static-examples interactive-examples performance-examples
@echo "โ
All examples generated successfully!"
@echo "๐ Check examples/output/ directory for results"
static-examples: setup-dirs
@echo "๐ Generating static plotting examples..."
@echo " - GPU performance comparison..."
cargo run --release --example gpu_performance_plot
@echo " - Scientific showcase..."
cargo run --release --example scientific_showcase 2>/dev/null || echo " (Scientific showcase example not found - skipping)"
@echo " - Memory optimization demo..."
cargo run --release --example memory_optimization_demo 2>/dev/null || echo " (Memory demo example not found - skipping)"
@echo " - Box plot demonstration..."
cargo run --release --example boxplot_example 2>/dev/null || echo " (Box plot example not found - skipping)"
@echo " - Histogram demonstration..."
cargo run --release --example histogram_example 2>/dev/null || echo " (Histogram example not found - skipping)"
@echo " - Performance scaling plots..."
cargo run --release --example create_performance_plot 2>/dev/null || echo " (Performance plot example not found - skipping)"
@echo "โ
Static examples completed"
interactive-examples: setup-dirs
@echo "๐ฎ Generating interactive plotting examples..."
@echo " - Basic interaction demo..."
cargo run --release --features interactive --example basic_interaction --no-window --output examples/output/interactive/ 2>/dev/null || \
cargo run --release --example basic_interaction 2>/dev/null || true
@echo " - Data brushing demo..."
cargo run --release --features interactive --example data_brushing --no-window --output examples/output/interactive/ 2>/dev/null || \
cargo run --release --example data_brushing 2>/dev/null || true
@echo " - Real-time performance demo..."
cargo run --release --features interactive --example real_time_performance --no-window --output examples/output/interactive/ 2>/dev/null || \
cargo run --release --example real_time_performance 2>/dev/null || true
@echo "โ
Interactive examples completed"
performance-examples: setup-dirs
@echo "๐ฌ Running performance benchmarks..."
@echo " - Interactive performance analysis..."
cargo run --release --features interactive --example real_time_performance > examples/output/performance/interactive_perf_report.txt 2>&1 || \
echo "Interactive performance test failed or not available" > examples/output/performance/interactive_perf_report.txt
@echo " - GPU vs CPU comparison..."
cargo run --release --example gpu_vs_cpu_benchmark > examples/output/performance/gpu_cpu_benchmark.txt 2>&1 || \
echo "GPU benchmark failed or not available" > examples/output/performance/gpu_cpu_benchmark.txt
@echo " - Memory usage analysis..."
cargo run --release --example performance_data_collector > examples/output/performance/memory_analysis.txt 2>&1 || \
echo "Memory analysis failed or not available" > examples/output/performance/memory_analysis.txt
@echo " - Scaling performance test..."
@echo "Testing performance with different dataset sizes..." > examples/output/performance/scaling_analysis.txt
@for size in 1000 10000 50000 100000; do \
echo "Testing $$size points..." >> examples/output/performance/scaling_analysis.txt; \
timeout 30s cargo run --release --example minimal_gpu_benchmark -- --points $$size >> examples/output/performance/scaling_analysis.txt 2>&1 || \
echo " Test with $$size points failed or timed out" >> examples/output/performance/scaling_analysis.txt; \
done
@echo "โ
Performance analysis completed"
web-examples: setup-dirs
@echo "๐ Building WebAssembly examples..."
@which wasm-pack > /dev/null || (echo "โ wasm-pack not found. Install with: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh" && exit 1)
@echo " - Building basic interaction for web..."
wasm-pack build --target web --out-dir examples/output/web/basic_interaction -- --features interactive 2>/dev/null || \
echo "Web build failed - interactive features may not be fully WASM compatible yet" > examples/output/web/build_status.txt
@echo " - Creating web demo page..."
@echo "<!DOCTYPE html>" > examples/output/web/index.html
@echo "<html><head><title>Ruviz Interactive Plotting Demo</title></head>" >> examples/output/web/index.html
@echo "<body><h1>๐ฎ Ruviz Interactive Plotting Demo</h1>" >> examples/output/web/index.html
@echo "<p>WebAssembly-powered interactive plotting in the browser.</p></body></html>" >> examples/output/web/index.html
@echo "โ
Web examples prepared (WASM implementation in progress)"
setup-dirs:
@mkdir -p examples/output/static
@mkdir -p examples/output/interactive
@mkdir -p examples/output/performance
@mkdir -p examples/output/web
@mkdir -p examples/output/documentation
docs: setup-dirs
@echo "๐ Generating example documentation..."
@echo "# Ruviz Example Gallery" > examples/output/documentation/README.md
@echo "" >> examples/output/documentation/README.md
@echo "This directory contains examples demonstrating the capabilities of the Ruviz interactive plotting library." >> examples/output/documentation/README.md
@echo "" >> examples/output/documentation/README.md
@echo "Generated on $$(date)" >> examples/output/documentation/README.md
@echo "๐ Documentation generated"
demo: setup-dirs
@echo "๐ Generating quick demo (subset of examples)..."
cargo run --release --example gpu_performance_plot
cargo run --release --example basic_interaction 2>/dev/null || true
@echo "โ
Quick demo completed"
test-compile:
@echo "๐จ Testing example compilation..."
cargo check --example basic_interaction --features interactive
cargo check --example data_brushing --features interactive
cargo check --example real_time_performance --features interactive
cargo check --example gpu_performance_plot
@echo "โ
All examples compile successfully"
clean:
@echo "๐งน Cleaning generated examples..."
rm -rf examples/output/
rm -f *.png *.txt *.html
cargo clean
@echo "โ
Cleanup completed"
setup-hooks:
@echo "๐ง Setting up git hooks..."
git config core.hooksPath .githooks
@echo "โ Git hooks configured to use .githooks/"
@echo "Pre-commit will now run: cargo fmt --check && cargo clippy"
check: fmt clippy
@echo "โ All checks passed!"
fmt:
@echo "Checking formatting..."
cargo fmt --all -- --check
clippy:
@echo "Running clippy..."
cargo clippy --all-targets --all-features -- -D warnings
doc-images:
@echo "๐ธ Generating documentation images at 300 DPI..."
./scripts/generate-doc-images.sh
@echo "โ Documentation images generated"
help:
@echo "Ruviz Example Generation System"
@echo "================================"
@echo ""
@echo "Available targets:"
@echo ""
@echo "Development:"
@echo " setup-hooks - Configure git pre-commit hooks"
@echo " check - Run all code quality checks (fmt + clippy)"
@echo " fmt - Check code formatting"
@echo " clippy - Run clippy linter"
@echo " doc-images - Generate documentation images"
@echo ""
@echo "Examples:"
@echo " all - Generate all examples (default)"
@echo " examples - Generate all examples"
@echo " static-examples - Generate static plot outputs"
@echo " interactive-examples - Generate interactive demos"
@echo " performance-examples - Run performance benchmarks"
@echo " web-examples - Build WebAssembly demos"
@echo " docs - Generate documentation"
@echo " demo - Quick demo (subset)"
@echo " test-compile - Test compilation without running"
@echo " clean - Remove all generated files"
@echo " help - Show this help"
@echo ""
@echo "Output directory: examples/output/"
@echo " static/ - PNG plot outputs"
@echo " interactive/ - Interactive demo results"
@echo " performance/ - Benchmark reports"
@echo " web/ - WebAssembly builds"
@echo " documentation/ - Example guides and README"
@echo ""
@echo "Requirements:"
@echo " - Rust 1.75+ with cargo"
@echo " - Optional: wasm-pack for web examples"
@echo " - Features: interactive, gpu (recommended)"
preview:
@echo "๐ Example Generation Preview"
@echo "============================="
@echo ""
@echo "Static Examples (examples/output/static/):"
@echo " - gpu_cpu_throughput.png - GPU vs CPU performance comparison"
@echo " - gpu_speedup.png - GPU acceleration scaling analysis"
@echo " - scientific_showcase.png - Multi-panel scientific figure"
@echo " - boxplot_example.png - Statistical box plot"
@echo " - histogram_example.png - Data distribution histogram"
@echo ""
@echo "Interactive Examples (examples/output/interactive/):"
@echo " - basic_interaction demo - Zoom/pan functionality"
@echo " - data_brushing demo - Multi-plot selection"
@echo " - real_time_performance demo - Large dataset interaction"
@echo ""
@echo "Performance Reports (examples/output/performance/):"
@echo " - gpu_cpu_benchmark.txt - Detailed benchmark results"
@echo " - interactive_perf_report.txt - Real-time analysis"
@echo " - memory_analysis.txt - Memory profiling"
@echo " - scaling_analysis.txt - Performance vs dataset size"
@echo ""
@echo "Web Examples (examples/output/web/):"
@echo " - index.html - Browser demo page"
@echo " - WASM modules (when available)"
@echo ""
@echo "Run 'make examples' to generate all outputs"