Files
desi_explorer/api/Makefile
sam_oneal fade4a17dc
CI / Detect changed paths (pull_request) Successful in 21s
CI / Odin unit tests and build (pull_request) Successful in 45s
CI / API unit tests and lint (pull_request) Failing after 28s
CI / Infra unit tests, vet, and preview (pull_request) Successful in 43s
additional changes
2026-09-07 19:51:22 -06:00

48 lines
1.3 KiB
Makefile

# api/Makefile — the Rust + axum backend API.
#
# Driven directly with `make -C api <target>` (or via the root Makefile's
# `api-*` convenience targets).
CARGO ?= cargo
ROOT := ..
# Normalize API_ENV_FILE / API_DESI_DATA (given relative to the repo root) to
# absolute paths so the API process can open them regardless of its working
# directory. "override" is required because they are usually passed as
# command-line/env vars, which would otherwise override any assignment here.
define normalize_path
ifdef $1
ifneq ($(abspath $($1)),$($1))
override $1 := $(abspath $(ROOT)/$($1))
endif
endif
endef
$(foreach v,API_ENV_FILE API_DESI_DATA,$(eval $(call normalize_path,$v)))
.PHONY: help setup run build test check fmt clean
help: ## List available targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-18s\033[0m %s\n", $$1, $$2}'
setup: ## Fetch dependencies
$(CARGO) fetch
run: ## Run the API server (dev)
$(CARGO) run
build: ## Release build -> target/release/
$(CARGO) build --release
test: ## Run unit/integration tests
$(CARGO) test
check: ## Format-check + lint (clippy -D warnings)
$(CARGO) fmt --all --check && $(CARGO) clippy --all-targets -- -D warnings
fmt: ## Format Rust sources with rustfmt
$(CARGO) fmt
clean: ## Remove Cargo build artifacts
$(CARGO) clean