CARGO ?= cargo
BIN := rq
.DEFAULT_GOAL := help
.PHONY: help build release install uninstall test check dogfood bench lint fmt clean
help:
@echo "rq targets:"
@echo " make build dev build → target/debug/$(BIN)"
@echo " make release optimized build → target/release/$(BIN)"
@echo " make install cargo install --path . (→ ~/.cargo/bin)"
@echo " make uninstall cargo uninstall $(BIN)"
@echo " make test cargo test"
@echo " make check pre-push gate: fmt + clippy + tests"
@echo " make dogfood run rq on its own source (Q=<query>, ARGS=<flags>)"
@echo " make bench search-latency benchmark (REPO=. by default)"
@echo " make lint cargo fmt --check && cargo clippy"
@echo " make fmt cargo fmt"
@echo " make clean cargo clean"
build:
$(CARGO) build
release:
$(CARGO) build --release
install:
$(CARGO) install --path .
uninstall:
$(CARGO) uninstall $(BIN)
test:
$(CARGO) test
check:
@script/check.sh
Q ?= Store
ARGS ?=
DOGFOOD_DB := $(CURDIR)/target/dogfood.db
dogfood: build
@rm -f "$(DOGFOOD_DB)" "$(DOGFOOD_DB)-wal" "$(DOGFOOD_DB)-shm"
@RQ_DB="$(DOGFOOD_DB)" ./target/debug/$(BIN) --index . >/dev/null
@RQ_DB="$(DOGFOOD_DB)" ./target/debug/$(BIN) $(Q) --no-record $(ARGS)
REPO ?= .
bench:
RQ_BENCH_REPO="$(REPO)" $(CARGO) test --release search_latency -- --ignored --nocapture
lint:
$(CARGO) fmt --check
$(CARGO) clippy --all-targets -- -D warnings
fmt:
$(CARGO) fmt
clean:
$(CARGO) clean