Skip to content

Commit fa515c8

Browse files
authored
Merge pull request #3236 from AkihiroSuda/do-not-strip
Makefile: allow setting KEEP_SYMBOLS=1
2 parents 135cf3e + bd2ad02 commit fa515c8

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Diff for: Makefile

+15-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ PACKAGE := github.com/lima-vm/lima
4646
VERSION := $(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
4747
VERSION_TRIMMED := $(VERSION:v%=%)
4848

49-
GO_BUILD_LDFLAGS := -ldflags="-s -w -X $(PACKAGE)/pkg/version.Version=$(VERSION)"
49+
KEEP_SYMBOLS ?=
50+
GO_BUILD_LDFLAGS_S := true
51+
ifeq ($(KEEP_SYMBOLS),1)
52+
GO_BUILD_LDFLAGS_S = false
53+
endif
54+
GO_BUILD_LDFLAGS := -ldflags="-s=$(GO_BUILD_LDFLAGS_S) -w -X $(PACKAGE)/pkg/version.Version=$(VERSION)"
5055
# `go -version -m` returns -tags with comma-separated list, because space-separated list is deprecated in go1.13.
5156
# converting to comma-separated list is useful for comparing with the output of `go version -m`.
5257
GO_BUILD_FLAG_TAGS := $(addprefix -tags=,$(shell echo "$(GO_BUILDTAGS)"|tr " " "\n"|paste -sd "," -))
@@ -68,7 +73,15 @@ help:
6873
@echo ' binaries - Build all binaries'
6974
@echo ' manpages - Build manual pages'
7075
@echo
71-
@echo " Use 'make help-targets' to see additional targets."
76+
@echo ' help-variables - Show Makefile variables'
77+
@echo ' help-targets - Show additional Makefile targets'
78+
79+
.PHONY: help-varaibles
80+
help-variables:
81+
@echo '# Variables that can be overridden.'
82+
@echo
83+
@echo '- PREFIX (directory) : Installation prefix (default: /usr/local)'
84+
@echo '- KEEP_SYMBOLS (1 or 0) : Whether to keep symbols (default: 0)'
7285

7386
.PHONY: help-targets
7487
help-targets:

Diff for: website/content/en/docs/installation/_index.md

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ make install
6060

6161
The installation directory (`$PREFIX`) defaults to `/usr/local`.
6262

63+
Run `make help-variables` to show other Makefile variables.
64+
6365
#### Advanced configuration with Kconfig tools
6466
(This step is not needed for most users)
6567

0 commit comments

Comments
 (0)