.PHONY: help build-macos build-linux

help:
	@echo "Story Kit – cross-platform build targets"
	@echo ""
	@echo "  make build-macos    Build native macOS release binary"
	@echo "  make build-linux    Build static Linux x86_64 release binary (requires cross + Docker)"
	@echo ""
	@echo "Prerequisites:"
	@echo "  build-macos: Rust stable toolchain, pnpm"
	@echo "  build-linux: cargo install cross   AND   Docker Desktop running"
	@echo ""
	@echo "Output:"
	@echo "  macOS : target/release/story-kit-server"
	@echo "  Linux : target/x86_64-unknown-linux-musl/release/story-kit-server"

## Build a native macOS release binary.
## The frontend is compiled by build.rs (pnpm build) and embedded via rust-embed.
## Verify dynamic deps afterwards: otool -L target/release/story-kit-server
build-macos:
	cargo build --release

## Build a fully static Linux x86_64 binary using the musl libc target.
## cross (https://github.com/cross-rs/cross) handles the Docker-based cross-compilation.
## Install cross:  cargo install cross
## The resulting binary has zero dynamic library dependencies (ldd reports "not a dynamic executable").
build-linux:
	cross build --release --target x86_64-unknown-linux-musl
