tl;dr: - Linux debugging works - macOS running works, debugging doesn't.
26 lines
924 B
Makefile
26 lines
924 B
Makefile
# Debug build by default: host and plugins must share the same flags,
|
|
# or plugin.Open fails with "plugin was built with a different version of package".
|
|
# Use "make FLAGS= clean all" for an optimized build of both.
|
|
FLAGS=-gcflags="all=-N -l"
|
|
|
|
# Every binary depends on the shared package, which defines Worker, and on the
|
|
# module files: a change there must rebuild all of them, or stale plugins fail
|
|
# to load with the same error as a flags mismatch.
|
|
SHARED=main.go go.mod go.sum
|
|
|
|
.PHONY: all clean
|
|
|
|
all: cmd/demo plugins/bar/bar.so plugins/foo/foo.so
|
|
|
|
clean:
|
|
rm -fr cmd/demo
|
|
find . -name "*.so" -delete
|
|
|
|
cmd/demo: cmd/demo.go $(SHARED)
|
|
go build $(FLAGS) -o cmd/demo ./cmd
|
|
|
|
plugins/bar/bar.so: plugins/bar/bar.go $(SHARED)
|
|
go build -buildmode=plugin $(FLAGS) -o plugins/bar/bar.so ./plugins/bar
|
|
|
|
plugins/foo/foo.so: plugins/foo/foo.go $(SHARED)
|
|
go build -buildmode=plugin $(FLAGS) -o plugins/foo/foo.so ./plugins/foo
|