.PHONY: all build build-release install install-release clean test check fmt lint run demo release bench
LEVEL ?= minor
BENCH_SIZE ?= 536870912
BENCH_DIR ?= /tmp/rget-bench
BENCH_REPS ?= 5
BENCH_PRESET ?= default
all: check build test
build:
cargo build
build-release:
cargo build --release
install:
CARGO_INCREMENTAL=0 cargo install --path . --locked --bins --debug --force
install-release:
CARGO_INCREMENTAL=0 cargo install --path . --locked --bins --force
clean:
cargo clean
test:
cargo test
check:
cargo check
cargo clippy -- -D warnings
fmt:
cargo fmt
lint:
cargo fmt -- --check
cargo clippy -- -D warnings
run:
cargo run -- $(ARGS)
demo: install
@echo "=== rget demo ==="
rget --help
release:
cargo release $(LEVEL) --execute --no-confirm
bench: build-release
@mkdir -p $(BENCH_DIR)
@test -f $(BENCH_DIR)/payload.bin || \
(echo "generating $(BENCH_SIZE) byte payload..." && \
head -c $(BENCH_SIZE) /dev/urandom > $(BENCH_DIR)/payload.bin)
@python3 scripts/bench/rangeserver.py $(BENCH_DIR)/payload.bin --port 8099 & \
SRV=$$!; sleep 2; \
python3 scripts/bench/run.py \
--url http://127.0.0.1:8099/file \
--source $(BENCH_DIR)/payload.bin \
--workdir $(BENCH_DIR)/wd --reps $(BENCH_REPS) --preset $(BENCH_PRESET); \
RC=$$?; kill $$SRV 2>/dev/null; exit $$RC