Skip to content

Commit 64e778a

Browse files
Merge pull request #2212 from openshift-cherrypick-robot/cherry-pick-2211-to-release-4.20
[release-4.20] OCPBUGS-77495: Makefile: Strip debugging symbols by default
2 parents 945759a + 85561b1 commit 64e778a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
1616
KUBE_GIT_MINOR_VERSION := "33"
1717
KUBE_GIT_VERSION := "v1.33.3"
1818

19+
STRIP_DEBUGGING_SYMBOLS ?= true
20+
ifeq ($(STRIP_DEBUGGING_SYMBOLS), true)
21+
STRIP_DEBUGGING_SYMBOLS_FLAGS := -s -w
22+
endif
23+
1924
GO_LD_EXTRAFLAGS :=-X k8s.io/component-base/version.gitMajor="1" \
2025
-X k8s.io/component-base/version.gitMinor=$(KUBE_GIT_MINOR_VERSION) \
2126
-X k8s.io/component-base/version.gitVersion=$(KUBE_GIT_VERSION) \
@@ -25,7 +30,8 @@ GO_LD_EXTRAFLAGS :=-X k8s.io/component-base/version.gitMajor="1" \
2530
-X k8s.io/client-go/pkg/version.gitVersion="$(SOURCE_GIT_TAG)" \
2631
-X k8s.io/client-go/pkg/version.gitCommit="$(SOURCE_GIT_COMMIT)" \
2732
-X k8s.io/client-go/pkg/version.buildDate="$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" \
28-
-X k8s.io/client-go/pkg/version.gitTreeState="$(SOURCE_GIT_TREE_STATE)"
33+
-X k8s.io/client-go/pkg/version.gitTreeState="$(SOURCE_GIT_TREE_STATE)" \
34+
$(STRIP_DEBUGGING_SYMBOLS_FLAGS)
2935

3036
GO_BUILD_PACKAGES :=$(strip \
3137
./cmd/... \

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ and the [Kubernetes project](https://github.com/kubernetes/kubernetes).
1919
To build oc invoke `make oc`. At any time you can invoke `make help` and you'll
2020
get a list of all supported make sub-commands.
2121

22+
By default `make oc` builds the executable without debugging symbols. To include
23+
debugging symbols, run `make STRIP_DEBUGGING_SYMBOLS=false oc`.
24+
2225
In order to build `oc`, you will need the GSSAPI sources. On a Fedora/CentOS/RHEL
2326
workstation, install them with:
2427

0 commit comments

Comments
 (0)