PLUGIN := listener_open_udc2.so
SRCS   := pl_main.go pl_transport.go
EXTRA  := config.yaml ax_config.axs
GO     := /usr/local/go/bin/go

.PHONY: all clean
all: dist/$(PLUGIN) $(addprefix dist/,$(EXTRA))

dist:
	@mkdir -p dist

dist/$(PLUGIN): $(SRCS) | dist
	@echo "    * Building $(PLUGIN)"
	@GOEXPERIMENT=jsonv2,greenteagc $(GO) build -buildmode=plugin -ldflags="-s -w" -o $@ $(SRCS)
	@echo "      done..."

dist/%: % | dist
	@cp $< $@

clean:
	@rm -rf dist
