# Noir — build helpers (.so plugin workflow)
#
# Local single-shot build:
#   make           # produces noir.so via CGO go build -buildmode=plugin
#   make templ     # regenerate *_templ.go files
#   make clean     # remove build artefacts

.PHONY: all clean templ help

PLUGIN_NAME := noir

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

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

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

help:
	@echo "Targets:"
	@echo "  all       Build $(PLUGIN_NAME).so (default)"
	@echo "  templ     Regenerate *_templ.go files"
	@echo "  clean     Remove build artefacts"
