mk: strip build dir from stack traces

Add the -trimpath flag to the default build command to remove the user's
path from stack traces.

Use a separate BUILD_OPTS make var to avoid it being accidentally
overridden on the command line.

Signed-off-by: Moritz Poldrack <git@moritz.sh>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Moritz Poldrack 2022-06-22 12:11:58 +02:00 committed by Robin Jarry
parent 420f236d31
commit 4ebeaa5b95

View file

@ -10,6 +10,7 @@ SHAREDIR?=$(PREFIX)/share/aerc
MANDIR?=$(PREFIX)/share/man MANDIR?=$(PREFIX)/share/man
GO?=go GO?=go
GOFLAGS?= GOFLAGS?=
BUILD_OPTS?=-trimpath
# ignore environment variable # ignore environment variable
GO_LDFLAGS:= GO_LDFLAGS:=
GO_LDFLAGS+=-X main.Version=$(VERSION) GO_LDFLAGS+=-X main.Version=$(VERSION)
@ -34,7 +35,7 @@ DOCS := \
all: aerc $(DOCS) all: aerc $(DOCS)
build_cmd:=$(GO) build $(GOFLAGS) -ldflags "$(GO_LDFLAGS)" -o aerc build_cmd:=$(GO) build $(BUILD_OPTS) $(GOFLAGS) -ldflags "$(GO_LDFLAGS)" -o aerc
# the following command outputs nothing, we only want to execute it once # the following command outputs nothing, we only want to execute it once
# and force .aerc.d to be regenerated when build_cmd has changed # and force .aerc.d to be regenerated when build_cmd has changed