diff options
author | Tyler Cipriani <tcipriani@wikimedia.org> | 2018-03-05 17:15:41 -0700 |
---|---|---|
committer | Tyler Cipriani <tcipriani@wikimedia.org> | 2018-03-06 08:08:04 -0700 |
commit | b790283b431af7462324bdd26ab948c42c943915 (patch) | |
tree | 8737c6b71aaaf4971786f7f7ae816948179c2261 | |
parent | 0902d688e99615150a674403e62c64b2f655c65c (diff) | |
download | blubber-b790283b431af7462324bdd26ab948c42c943915.tar.gz |
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]. <https://github.com/golang/go/wiki/GOPATH#use-a-single-gopath>
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
-rw-r--r-- | Makefile | 20 |
1 files changed, 3 insertions, 17 deletions
@@ -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 |