# Vorleser — developer entry points. See AGENTS.md.
PKG        := Packages/VorleserKit
PROJECT    := Vorleser.xcodeproj
SCHEME     := Vorleser
DERIVED    := .build/xcode
APP_PATH   := $(DERIVED)/Build/Products/Debug/Vorleser.app

.PHONY: bootstrap generate build build-pkg build-app test live-test verify app fixtures smoke privacy-check format clean

bootstrap:
	@scripts/bootstrap.sh

generate:
	xcodegen generate --spec project.yml

build: build-pkg build-app

build-pkg:
	swift build --package-path $(PKG)

build-app: generate
	xcodebuild -project $(PROJECT) -scheme $(SCHEME) -configuration Debug \
	  -derivedDataPath $(DERIVED) -destination 'platform=macOS,arch=arm64' -quiet build

test:
	swift test --package-path $(PKG) --skip VorleserLiveTests

live-test:
	VORLESER_LIVE=1 swift test --package-path $(PKG) --filter VorleserLiveTests

verify:
	@scripts/verify.sh

app: build-app
	@pkill -x Vorleser 2>/dev/null || true
	open "$(APP_PATH)"

fixtures:
	@scripts/capture-fixtures.sh

smoke:
	@scripts/smoke-ollama.sh

privacy-check:
	@scripts/privacy-check.sh

format:
	@command -v swiftformat >/dev/null && swiftformat App $(PKG) || echo "swiftformat not installed (make bootstrap)"

clean:
	rm -rf .build $(PKG)/.build $(PROJECT)
