# Regenerate Go bindings from the public ZAP schema.
#
# Hand-rolled stubs live in ./gen/ so `go build` works without zapc
# installed locally. When zapc is available the generated files take
# their place; the package layout/import path remains stable.
#
# Brand policy: ZAP only — never reference Cap'n Proto on the public
# surface (HIP-0106).

SCHEMA := ../schema/bootnode.zap
OUT    := ./gen

.PHONY: gen check clean

gen:
	@command -v zapc >/dev/null 2>&1 || { \
	  echo "zapc not installed — keeping hand-rolled stubs in $(OUT)"; \
	  exit 0; \
	}
	zapc generate $(SCHEMA) --lang go --out $(OUT)

check:
	@command -v zapc >/dev/null 2>&1 || { echo "zapc not installed"; exit 1; }
	zapc check $(SCHEMA)

clean:
	rm -f $(OUT)/*.gen.go
