export RUSTFLAGS := "-C target-cpu=native"
export WEBKIT_DISABLE_COMPOSITING_MODE := "1"

build:
  cargo tauri build --no-bundle -- --profile dev

run:
  cargo tauri dev

fmt:
  cargo +nightly fmt

_fix:
  cargo fix
  cargo clippy --fix

fix: _fix fmt

clippy:
  cargo clippy

test:
  cargo test --workspace

clean:
  cargo clean

peer-cli-build:
  cargo build -p lanspread-peer-cli

peer-cli-image:
  docker build -f crates/lanspread-peer-cli/Dockerfile -t lanspread-peer-cli:dev .

peer-cli-run NAME:
  mkdir -p "target/peer-cli/{{NAME}}/state" "target/peer-cli/{{NAME}}/games"
  docker run --rm --init --network host --name "lanspread-peer-cli-{{NAME}}" -i \
    -v "$PWD/target/peer-cli/{{NAME}}/state:/state" \
    -v "$PWD/target/peer-cli/{{NAME}}/games:/games" \
    lanspread-peer-cli:dev \
    --name "{{NAME}}" \
    --games-dir /games \
    --state-dir /state \
    --catalog-db /app/game.db
