# Brutalist — local build helpers (.so plugin)
#
# Local single-shot build only. Does NOT deploy to a running CMS container.
# Use `make` (default) to build brutalist.so via CGO go build -buildmode=plugin.

.PHONY: all clean templ help

PLUGIN_NAME := brutalist

# Default target: build the .so locally.
all: $(PLUGIN_NAME).so

# Local plugin build (no container). Useful for CI / quick checks.
$(PLUGIN_NAME).so: $(wildcard *.go) plugin.mod go.mod presets.json fonts.json $(wildcard schemas/*.json)
	CGO_ENABLED=1 go build -buildmode=plugin -ldflags="-s -w" -o $(PLUGIN_NAME).so .

# Regenerate templ Go files locally.
templ:
	templ generate

# Remove built artefacts.
clean:
	rm -f $(PLUGIN_NAME).so

help:
	@echo "Targets:"
	@echo "  all     Build $(PLUGIN_NAME).so locally (default)"
	@echo "  templ   Regenerate templ-generated Go files"
	@echo "  clean   Remove built .so"
