Skip to content

Makefile: allow setting KEEP_SYMBOLS=1 #3236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ PACKAGE := github.com/lima-vm/lima
VERSION := $(shell git describe --match 'v[0-9]*' --dirty='.m' --always --tags)
VERSION_TRIMMED := $(VERSION:v%=%)

GO_BUILD_LDFLAGS := -ldflags="-s -w -X $(PACKAGE)/pkg/version.Version=$(VERSION)"
KEEP_SYMBOLS ?=
GO_BUILD_LDFLAGS_S := true
ifeq ($(KEEP_SYMBOLS),1)
GO_BUILD_LDFLAGS_S = false
endif
GO_BUILD_LDFLAGS := -ldflags="-s=$(GO_BUILD_LDFLAGS_S) -w -X $(PACKAGE)/pkg/version.Version=$(VERSION)"
# `go -version -m` returns -tags with comma-separated list, because space-separated list is deprecated in go1.13.
# converting to comma-separated list is useful for comparing with the output of `go version -m`.
GO_BUILD_FLAG_TAGS := $(addprefix -tags=,$(shell echo "$(GO_BUILDTAGS)"|tr " " "\n"|paste -sd "," -))
Expand All @@ -68,7 +73,15 @@ help:
@echo ' binaries - Build all binaries'
@echo ' manpages - Build manual pages'
@echo
@echo " Use 'make help-targets' to see additional targets."
@echo ' help-variables - Show Makefile variables'
@echo ' help-targets - Show additional Makefile targets'

.PHONY: help-varaibles
help-variables:
@echo '# Variables that can be overridden.'
@echo
@echo '- PREFIX (directory) : Installation prefix (default: /usr/local)'
@echo '- KEEP_SYMBOLS (1 or 0) : Whether to keep symbols (default: 0)'

.PHONY: help-targets
help-targets:
Expand Down
2 changes: 2 additions & 0 deletions website/content/en/docs/installation/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ make install

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

Run `make help-variables` to show other Makefile variables.

#### Advanced configuration with Kconfig tools
(This step is not needed for most users)

Expand Down
Loading