# Sci-Fi Clean — build helpers (.so plugin workflow)
#
# Local-only targets. `make` produces scifi-clean.so via CGO go build -buildmode=plugin.
# `make rebuild` deploys to the live CMS container and is intentionally NOT defined here
# in this implementation pass — see gotham/Makefile if/when you want to add it.

.PHONY: all clean templ help

PLUGIN_NAME := scifi-clean
TEMPL       := $(HOME)/go/bin/templ

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

# Local plugin build (no container).
$(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

# Remove build artefacts.
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 built .so"
