From 333de52137cc21175cb1dadb501a943f46c6088d Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Mon, 23 Mar 2020 17:19:13 -0700 Subject: [PATCH] Makefile: Use trimpath if available Passing -trimpath makes the build entirely reproducible. Signed-off-by: Joe Richey --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 014c6105..0dbb8fe9 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,10 @@ override GO_LINK_FLAGS += $(VERSION_FLAG) -extldflags "$(LDFLAGS)" override GO_FLAGS += --ldflags '$(GO_LINK_FLAGS)' # Always use Go modules export GO111MODULE = on +# Use -trimpath if available +ifneq "" "$(shell go help build | grep trimpath)" +override GO_FLAGS += -trimpath +endif ###### Find All Files and Directories ###### FILES := $(shell find . -path '*/.git*' -prune -o -type f -printf "%P\n")