From b790283b431af7462324bdd26ab948c42c943915 Mon Sep 17 00:00:00 2001 From: Tyler Cipriani Date: Mon, 5 Mar 2018 17:15:41 -0700 Subject: Makefile: install to global GOPATH with correct -ldflags Summary: Since we now use ldflags to set global variables it's helpful to automate via Make. Using a single global GOPATH seems to jive more with the best-practice established in the go community[0] and make testing/code review easier. [0]. Test Plan: run make Reviewers: dduvall, #release-engineering-team Reviewed By: dduvall, #release-engineering-team Tags: #release-engineering-team Differential Revision: https://phabricator.wikimedia.org/D998 --- Makefile | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 84d62f7..cb06b90 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,10 @@ -export GOPATH=$(CURDIR)/.build PACKAGE := phabricator.wikimedia.org/source/blubber -export BUILD_DIR=$(GOPATH)/src/$(PACKAGE) -BINARY :=$(CURDIR)/bin/blubber GO_LDFLAGS := \ -X $(PACKAGE)/meta.Version=$(shell cat VERSION) \ -X $(PACKAGE)/meta.GitCommit=$(shell git rev-parse --short HEAD) -all: clean bin/blubber +install: + go install -v -ldflags "$(GO_LDFLAGS)" -clean: - rm -rf $(CURDIR)/.build - rm -rf $(BINARY) - -bin/blubber: - mkdir -p $(dir $(BUILD_DIR)) - ln -s $(CURDIR) $(BUILD_DIR) - cd $(BUILD_DIR) && go build -v -i -ldflags "$(GO_LDFLAGS)" - mkdir -p $(CURDIR)/bin && mv $(BUILD_DIR)/blubber $(BINARY) - rm -rf $(CURDIR)/.build - - -.PHONY: all clean +.PHONY: install -- cgit v1.2.1