# Portes du projet. `make` seul lance tout ce qui doit être vert avant un commit.

.PHONY: all fmt lint test build proto bench clean

all: fmt lint test build

fmt:
	cargo fmt --all
	npm --prefix apps/viewer run format

lint:
	cargo fmt --all --check
	cargo clippy --workspace --all-targets -- -D warnings
	npm --prefix apps/viewer run lint

# `--skip export_bindings` : les tests de génération de ts-rs écriraient dans
# apps/viewer/src/proto à chaque exécution. La cible `proto` s'en charge, avec
# le formatage qui va avec.
test:
	cargo test --workspace -- --skip export_bindings

# Les types TypeScript du protocole sont générés, jamais écrits à la main.
# Ils sont exclus du formateur et du linter (voir biome.json): leur format
# appartient à ts-rs, sinon chaque `make` laisse un diff dans le dépôt.
proto:
	cargo test -p rs-proto export_bindings

build:
	cargo build --workspace
	npm --prefix apps/viewer run build

# Banc d'essai: toujours en release, un binaire debug fausse les mesures.
bench:
	cargo run --release -p rs-signaling --bin rustscreen -- --synthetic

clean:
	cargo clean
	rm -rf apps/viewer/dist
