Skip to content

Commit 9c21c99

Browse files
authored
chore(Makefile): add PRODUCTION flag to handle stripped builds (#2057)
* chore(Makefile): add PRODUCTION flag to handle stripped builds Signed-off-by: Vinícius Zavam <egypcio@googlemail.com>
1 parent ff2c59d commit 9c21c99

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ ifeq ($(shell ldconfig -p | grep -q libhlml.so && echo exists),exists)
4747
GPU_TAGS := habana
4848
endif
4949

50+
# Use PRODUCTION to enable/disable stripping binaries for the kepler exporter
51+
# and validator. That reduces the size of the binaries and removes debug symbols.
52+
# Expected values for this flag are:
53+
# 0 - Unstripped binaries including debug symbols (default);
54+
# 1 - Stripped binaries.
55+
# More about stripped binaries and debug symbols can be found at the RedHat's developer portal here:
56+
# * https://developers.redhat.com/articles/2024/04/03/how-add-debug-support-go-stripped-binaries
57+
#
58+
PRODUCTION ?= 0
59+
ifeq ($(PRODUCTION),1)
60+
LDFLAGS+= -s -w
61+
endif
62+
5063
# set GOENV
5164
GOOS := $(shell go env GOOS)
5265
GOARCH := $(shell go env GOARCH)

0 commit comments

Comments
 (0)