| 1 |
.PHONY: all build test dev bench format clean examples gen_proto |
| 2 |
|
| 3 |
ENABLE_FEATURES ?= default |
| 4 |
|
| 5 |
all: format build test examples |
| 6 |
|
| 7 |
build: |
| 8 |
cargo build --features="${ENABLE_FEATURES}" |
| 9 |
|
| 10 |
test: |
| 11 |
cargo test --features="${ENABLE_FEATURES}" -- --nocapture |
| 12 |
|
| 13 |
dev: format test |
| 14 |
|
| 15 |
bench: format |
| 16 |
cargo bench --features=${ENABLE_FEATURES} -- --nocapture |
| 17 |
|
| 18 |
format: |
| 19 |
@cargo fmt --all -- --check >/dev/null || cargo fmt --all |
| 20 |
|
| 21 |
clean: |
| 22 |
cargo clean |
| 23 |
|
| 24 |
examples: |
| 25 |
cargo build --example example_embed |
| 26 |
cargo build --example example_hyper |
| 27 |
cargo build --features="push" --example example_push |
| 28 |
cargo build --features="process" --example example_process_collector |
| 29 |
|
| 30 |
gen_proto: |
| 31 |
@ which protoc >/dev/null || { echo "Please install protoc first"; exit 1; } |
| 32 |
@ which protoc-gen-rust >/dev/null || { echo "Please install protobuf rust plugin, cargo install protobuf"; exit 1; } |
| 33 |
protoc --rust_out proto proto/metrics.proto |