From 99257a936d64e16db970baa216517a4911bf600c Mon Sep 17 00:00:00 2001 From: Christoph Mewes Date: Tue, 16 Sep 2025 19:46:09 +0200 Subject: [PATCH] allow to set $DEBUG_BUILD to build a binary with debugging symbols included and paths not trimmed On-behalf-of: @SAP christoph.mewes@sap.com --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5fef658..a5fd220 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,16 @@ GIT_VERSION = $(shell git describe --tags --always --match='v*') LDFLAGS += -extldflags '-static' \ -X github.com/kcp-dev/api-syncagent/internal/version.gitVersion=$(GIT_VERSION) \ -X github.com/kcp-dev/api-syncagent/internal/version.gitHead=$(GIT_HEAD) +LDFLAGS_EXTRA ?= -w + +ifdef DEBUG_BUILD +GOFLAGS = -mod=readonly +LDFLAGS_EXTRA = +GOTOOLFLAGS_EXTRA = -gcflags=all="-N -l" +endif + BUILD_DEST ?= _build -GOTOOLFLAGS ?= $(GOBUILDFLAGS) -ldflags '-w $(LDFLAGS)' $(GOTOOLFLAGS_EXTRA) +GOTOOLFLAGS ?= $(GOBUILDFLAGS) -ldflags '$(LDFLAGS) $(LDFLAGS_EXTRA)' $(GOTOOLFLAGS_EXTRA) GOARCH ?= $(shell go env GOARCH) GOOS ?= $(shell go env GOOS)