11# Variables
22PKG = github.com/habedi/vq
3- BINARY_NAME = $(or $(PROJ_BINARY ) , $(notdir $(PKG ) ) )
3+ BINARY_NAME = $(or $(PROJ_BINARY ) , $(notdir $(PKG ) -examples ) )
44BINARY = target/release/$(BINARY_NAME )
55PATH := /snap/bin:$(PATH )
66CARGO_TERM_COLOR = always
7+ RUST_BACKTRACE = 1
8+ RUST_LOG = info
79DEBUG_VQ = 0
810
911# Default target
@@ -16,64 +18,77 @@ help: ## Show this help message
1618.PHONY : format
1719format : # # Format Rust files
1820 @echo " Formatting Rust files..."
19- cargo fmt
21+ @ cargo fmt
2022
2123.PHONY : test
2224test : format # # Run tests
2325 @echo " Running tests..."
24- DEBUG_VQ=$(DEBUG_VQ ) cargo test -- --nocapture
26+ @ DEBUG_VQ=$(DEBUG_VQ ) cargo test -- --nocapture
2527
2628.PHONY : coverage
2729coverage : format # # Generate test coverage report
2830 @echo " Generating test coverage report..."
29- DEBUG_VQ=$(DEBUG_VQ ) cargo tarpaulin --out Xml --out Html
31+ @ DEBUG_VQ=$(DEBUG_VQ ) cargo tarpaulin --out Xml --out Html
3032
3133.PHONY : build
3234build : format # # Build the binary for the current platform
3335 @echo " Building the project..."
34- DEBUG_VQ=$(DEBUG_VQ ) cargo build --release
36+ @ DEBUG_VQ=$(DEBUG_VQ ) cargo build --release
3537
3638.PHONY : run
3739run : build # # Build and run the binary
3840 @echo " Running the $( BINARY) binary..."
39- DEBUG_VQ=$(DEBUG_VQ ) ./$(BINARY )
41+ @ DEBUG_VQ=$(DEBUG_VQ ) ./$(BINARY )
4042
4143.PHONY : clean
4244clean : # # Remove generated and temporary files
4345 @echo " Cleaning up..."
44- cargo clean
46+ @cargo clean
47+ @rm -f benchmark_results.csv
48+ @rm -f eval_* .csv
4549
4650.PHONY : install-snap
4751install-snap : # # Install a few dependencies using Snapcraft
4852 @echo " Installing the snap package..."
49- sudo apt-get update
50- sudo apt-get install -y snapd
51- sudo snap refresh
52- sudo snap install rustup --classic
53+ @ sudo apt-get update
54+ @ sudo apt-get install -y snapd
55+ @ sudo snap refresh
56+ @ sudo snap install rustup --classic
5357
5458.PHONY : install-deps
5559install-deps : install-snap # # Install development dependencies
5660 @echo " Installing dependencies..."
57- rustup component add rustfmt clippy
58- cargo install cargo-tarpaulin
59- cargo install cargo-audit
61+ @ rustup component add rustfmt clippy
62+ @ cargo install cargo-tarpaulin
63+ @ cargo install cargo-audit
6064
6165.PHONY : lint
6266lint : format # # Run linters on Rust files
6367 @echo " Linting Rust files..."
64- DEBUG_VQ=$(DEBUG_VQ ) cargo clippy -- -D warnings
68+ @ DEBUG_VQ=$(DEBUG_VQ ) cargo clippy -- -D warnings
6569
6670.PHONY : publish
6771publish : # # Publish the package to crates.io (requires CARGO_REGISTRY_TOKEN to be set)
6872 @echo " Publishing the package to Cargo registry..."
69- cargo publish --token $(CARGO_REGISTRY_TOKEN )
73+ @ cargo publish --token $(CARGO_REGISTRY_TOKEN )
7074
7175.PHONY : bench
7276bench : # # Run benchmarks
7377 @echo " Running benchmarks..."
74- DEBUG_VQ=$(DEBUG_VQ ) cargo bench
78+ @ DEBUG_VQ=$(DEBUG_VQ ) cargo bench
7579
76- .PHONY : audit
77- audit : # # Run security audit on Rust dependencies
78- @echo " Running security audit..."
79- cargo audit
80+ .PHONY : eval
81+ eval : # # Evaluate an implementation (the ALG should be the algorithm name, e.g., bq, sq, pq, opq, tsvq, rvq)
82+ @echo && if [ -z " $( ALG) " ]; then echo " Please provide the ALG argument" ; exit 1; fi
83+ @echo " Evaluating implementation with argument: $( ALG) "
84+ @cargo run --release --bin eval -- --eval $(ALG )
85+
86+ .PHONY : eval-all
87+ eval-all : # # Evaluate all the implementations (bq, sq, pq, opq, tsvq, rvq)
88+ @echo " Evaluating all implementations..."
89+ @cargo run --release --bin eval -- --eval bq
90+ @cargo run --release --bin eval -- --eval sq
91+ @cargo run --release --bin eval -- --eval pq
92+ @cargo run --release --bin eval -- --eval opq
93+ @cargo run --release --bin eval -- --eval tsvq
94+ @cargo run --release --bin eval -- --eval rvq
0 commit comments