From 0821990720b8b9cc14302e4a70543a50218b2d67 Mon Sep 17 00:00:00 2001 From: Oleksandr Shulgin Date: Thu, 2 Feb 2017 10:17:02 +0100 Subject: [PATCH] Only set -i flag of go build when compiling locally This fixes permissions problem when building linux target on CD. --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cf661fd22..5ccf7a3cc 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ ifeq ($(RACE),1) endif BINARY ?= postgres-operator -BUILD_FLAGS ?= -i -v +BUILD_FLAGS ?= -v +LOCAL_BUILD_FLAGS ?= $(BUILD_FLAGS) -i LDFLAGS ?= -X=main.version=$(VERSION) DOCKERFILE = docker/Dockerfile IMAGE ?= pierone.example.com/acid/$(BINARY) @@ -32,10 +33,10 @@ linux: build/linux/${BINARY} macos: build/macos/${BINARY} build/${BINARY}: ${SOURCES} - go build -o $@ $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" $^ + go build -o $@ $(LOCAL_BUILD_FLAGS) -ldflags "$(LDFLAGS)" $^ build/linux/${BINARY}: ${SOURCES} - GOOS=linux GOARCH=amd64 go build -o $@ ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $^ + GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o $@ ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $^ build/macos/${BINARY}: ${SOURCES} GOOS=darwin GOARCH=amd64 go build -o $@ ${BUILD_FLAGS} -ldflags "$(LDFLAGS)" $^