From e1c3d29145feaaac34f08b145abf6001225b882c Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Wed, 13 Mar 2019 02:04:01 +0100 Subject: [PATCH] Support RELRO and reproducible builds (#27) --- Makefile | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 4c56fc4..37df0c4 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,12 @@ BIN ?= browserpass VERSION ?= undefined -APP_ID = com.github.browserpass.native -OS = $(shell uname -s) +GO_GCFLAGS := "all=-trimpath=${PWD}" +GO_ASMFLAGS := "all=-trimpath=${PWD}" +GO_LDFLAGS := "-extldflags ${LDFLAGS}" + +APP_ID := com.github.browserpass.native +OS := $(shell uname -s) ####################### # For local development @@ -11,22 +15,22 @@ OS = $(shell uname -s) all: browserpass test browserpass: *.go **/*.go - go build -o $@ + go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $@ browserpass-linux64: *.go **/*.go - env GOOS=linux GOARCH=amd64 go build -o $@ + env GOOS=linux GOARCH=amd64 go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $@ browserpass-darwinx64: *.go **/*.go - env GOOS=darwin GOARCH=amd64 go build -o $@ + env GOOS=darwin GOARCH=amd64 go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $@ browserpass-openbsd64: *.go **/*.go - env GOOS=openbsd GOARCH=amd64 go build -o $@ + env GOOS=openbsd GOARCH=amd64 go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $@ browserpass-freebsd64: *.go **/*.go - env GOOS=freebsd GOARCH=amd64 go build -o $@ + env GOOS=freebsd GOARCH=amd64 go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $@ browserpass-windows64: *.go **/*.go - env GOOS=windows GOARCH=amd64 go build -o $@.exe + env GOOS=windows GOARCH=amd64 go build -ldflags $(GO_LDFLAGS) -gcflags $(GO_GCFLAGS) -asmflags $(GO_ASMFLAGS) -o $@.exe .PHONY: test test: