Add dynamic binary make target
Adds a dynamic make target to allow for making a dynamic binary without
having to do ugly `GO_BUILD` mangling.
Default functionality should remain the same.
@@ -24,8 +24,9 @@ ifeq ($(OS),Windows_NT)
EXEC_EXT := .exe
endif
-GO_BUILD := CGO_ENABLED=0 go build -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
-GO_TEST := CGO_ENABLED=0 go test -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
+STATIC_FLAGS= CGO_ENABLED=0
+GO_BUILD = $(STATIC_FLAGS) go build -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
+GO_TEST = $(STATIC_FLAGS) go test -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
all: bin/$(BIN_NAME) test
@@ -41,6 +42,10 @@ cross-standalone: bin/${BIN_STANDALONE_NAME}-linux bin/${BIN_STANDALONE_NAME}-da
e2e-cross: bin/$(BIN_NAME)-e2e-linux bin/$(BIN_NAME)-e2e-darwin bin/$(BIN_NAME)-e2e-windows.exe
+.PHONY: dynamic
+dynamic: STATIC_FLAGS :=
+dynamic: bin/$(BIN_NAME)
+
.PHONY: bin/${BIN_STANDALONE_NAME}-windows
bin/${BIN_STANDALONE_NAME}-%.exe bin/${BIN_STANDALONE_NAME}-%: cmd/${BIN_STANDALONE_NAME} check_go_env
GOOS=$* $(GO_BUILD) -o $@ ./$<
