From 719e8487343f4db17abc4139ec1a85a30cc9b923 Mon Sep 17 00:00:00 2001 From: Ondra Kupka Date: Mon, 16 Feb 2026 12:01:03 +0100 Subject: [PATCH] Makefile: Strip debugging symbols by default You can still run `make STRIP_DEBUGGING_SYMBOLS=false oc` to skip that. --- Makefile | 8 +++++++- README.md | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 45c6e531ac..1f140fa1d7 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,11 @@ include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \ KUBE_GIT_MINOR_VERSION := "34" KUBE_GIT_VERSION := "v1.34.1" +STRIP_DEBUGGING_SYMBOLS ?= true +ifeq ($(STRIP_DEBUGGING_SYMBOLS), true) + STRIP_DEBUGGING_SYMBOLS_FLAGS := -s -w +endif + GO_LD_EXTRAFLAGS :=-X k8s.io/component-base/version.gitMajor="1" \ -X k8s.io/component-base/version.gitMinor=$(KUBE_GIT_MINOR_VERSION) \ -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" \ -X k8s.io/client-go/pkg/version.gitVersion="$(SOURCE_GIT_TAG)" \ -X k8s.io/client-go/pkg/version.gitCommit="$(SOURCE_GIT_COMMIT)" \ -X k8s.io/client-go/pkg/version.buildDate="$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" \ - -X k8s.io/client-go/pkg/version.gitTreeState="$(SOURCE_GIT_TREE_STATE)" + -X k8s.io/client-go/pkg/version.gitTreeState="$(SOURCE_GIT_TREE_STATE)" \ + $(STRIP_DEBUGGING_SYMBOLS_FLAGS) GO_BUILD_PACKAGES :=$(strip \ ./cmd/... \ diff --git a/README.md b/README.md index 9198bc1bb7..5c4d6a8f45 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ and the [Kubernetes project](https://github.com/kubernetes/kubernetes). To build oc invoke `make oc`. At any time you can invoke `make help` and you'll get a list of all supported make sub-commands. +By default `make oc` builds the executable without debugging symbols. To include +debugging symbols, run `make STRIP_DEBUGGING_SYMBOLS=false oc`. + In order to build `oc`, you will need the GSSAPI sources. On a Fedora/CentOS/RHEL workstation, install them with: