aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Linderud <morten@linderud.pw>2018-10-09 22:24:44 +0200
committerMorten Linderud <morten@linderud.pw>2019-09-24 11:07:36 +0200
commit44d13f3c15d2a16d674cb8f6debc0257a00616cd (patch)
treecbfa07cf052e62b95d73d540fe7bf90a8b516137
parentwinpipe: use x/sys/windows instead of syscall (diff)
downloadwireguard-go-ml/goflags.tar.xz
wireguard-go-ml/goflags.zip
Added default GOFLAGSml/goflags
- Remove symbol table - Disable DWARF generation - Trim build path from the build artefact. Achives reproducible binaries Signed-off-by: Morten Linderud <morten@linderud.pw>
-rw-r--r--Makefile5
1 files changed, 4 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 842e069..1fc7015 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,9 @@ PREFIX ?= /usr
DESTDIR ?=
BINDIR ?= $(PREFIX)/bin
export GO111MODULE := on
+GOFLAGS := -buildmode=pie -trimpath
+export CGO_LDFLAGS := $(LDFLAGS)
+export CGO_CFLAGS := $(CFLAGS)
all: generate-version-and-build
@@ -17,7 +20,7 @@ generate-version-and-build:
@$(MAKE) wireguard-go
wireguard-go: $(wildcard *.go) $(wildcard */*.go)
- go build -v -o "$@"
+ go build -v -o "$@" $(GOFLAGS)
install: wireguard-go
@install -v -d "$(DESTDIR)$(BINDIR)" && install -v -m 0755 "$<" "$(DESTDIR)$(BINDIR)/wireguard-go"