Skip to content

Commit 6d3d7a8

Browse files
committed
Merge commit '86ff580217f7b59219ae9a42b1311969a2723c72' into r30_rel_tools
2 parents 271a825 + 86ff580 commit 6d3d7a8

File tree

2 files changed

+162
-123
lines changed

2 files changed

+162
-123
lines changed

release-tools/build.make

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
# This is the default. It can be overridden in the main Makefile after
2222
# including build.make.
23-
REGISTRY_NAME=quay.io/k8scsi
23+
REGISTRY_NAME?=quay.io/k8scsi
2424

2525
# Can be set to -mod=vendor to ensure that the "vendor" directory is used.
2626
GOFLAGS_VENDOR=
@@ -69,12 +69,17 @@ endif
6969
# toolchain.
7070
BUILD_PLATFORMS =
7171

72+
# Add go ldflags using LDFLAGS at the time of compilation.
73+
IMPORTPATH_LDFLAGS = -X main.version=$(REV)
74+
EXT_LDFLAGS = -extldflags "-static"
75+
LDFLAGS =
76+
FULL_LDFLAGS = $(LDFLAGS) $(IMPORTPATH_LDFLAGS) $(EXT_LDFLAGS)
7277
# This builds each command (= the sub-directories of ./cmd) for the target platform(s)
7378
# defined by BUILD_PLATFORMS.
7479
$(CMDS:%=build-%): build-%: check-go-version-go
7580
mkdir -p bin
7681
echo '$(BUILD_PLATFORMS)' | tr ';' '\n' | while read -r os arch suffix; do \
77-
if ! (set -x; CGO_ENABLED=0 GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o "./bin/$*$$suffix" ./cmd/$*); then \
82+
if ! (set -x; CGO_ENABLED=0 GOOS="$$os" GOARCH="$$arch" go build $(GOFLAGS_VENDOR) -a -ldflags '$(FULL_LDFLAGS)' -o "./bin/$*$$suffix" ./cmd/$*); then \
7883
echo "Building $* for GOOS=$$os GOARCH=$$arch failed, see error(s) above."; \
7984
exit 1; \
8085
fi; \

0 commit comments

Comments
 (0)