# Magazine Bold — local build helpers
#
# The plugin compiles to a .so shared object loaded by the CMS at runtime.
#
# Usage:
#   make           # Build magazine-bold.so locally (default)
#   make templ     # Regenerate templ Go files
#   make clean     # Remove the built .so

.PHONY: all templ clean help

PLUGIN_NAME := magazine-bold
TEMPL       := $(HOME)/go/bin/templ

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

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

# Regenerate templ Go files locally (for development).
templ:
	$(TEMPL) generate

clean:
	rm -f $(PLUGIN_NAME).so

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