# Earthen — build helpers (.so plugin workflow)
#
# Local build only. This Makefile deliberately does NOT include rebuild/deploy
# targets to avoid touching the live CMS container during agent runs.

.PHONY: all clean templ help

PLUGIN_NAME := earthen

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

# Local plugin build.
$(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.
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 Go files"
	@echo "  clean   Remove built .so"
