# Editorial — local plugin build helpers.
#
# This Makefile intentionally focuses on the local single-shot build target.
# The remote deploy targets (e.g. `make rebuild`) are not provided here to
# keep the build pass scoped to local artefact production.
#
# Usage:
#   make             # default: produce editorial.so
#   make templ       # regenerate *_templ.go from *.templ
#   make clean       # remove editorial.so

.PHONY: all clean templ

PLUGIN_NAME := editorial
TEMPL       := $(HOME)/go/bin/templ

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

$(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.
templ:
	$(TEMPL) generate

clean:
	rm -f $(PLUGIN_NAME).so
