build: update makefile to be aware of go modules, remove dep support
In this commit, we update the makefile to be aware of go modules. Along the way, we remove all references to dep as we no longer use it within this project. Note that in order to allow usage of go modules within the $GOPATH directory, we set the `GO111MODULE=on` environment variable.
This commit is contained in:
parent
e5f4b7ca66
commit
e2e73379c7
31
Makefile
31
Makefile
@ -1,20 +1,17 @@
|
||||
PKG := github.com/lightningnetwork/lnd
|
||||
ESCPKG := github.com\/lightningnetwork\/lnd
|
||||
|
||||
DEP_PKG := github.com/golang/dep/cmd/dep
|
||||
BTCD_PKG := github.com/btcsuite/btcd
|
||||
GLIDE_PKG := github.com/Masterminds/glide
|
||||
GOVERALLS_PKG := github.com/mattn/goveralls
|
||||
LINT_PKG := gopkg.in/alecthomas/gometalinter.v2
|
||||
|
||||
GO_BIN := ${GOPATH}/bin
|
||||
DEP_BIN := $(GO_BIN)/dep
|
||||
BTCD_BIN := $(GO_BIN)/btcd
|
||||
GLIDE_BIN := $(GO_BIN)/glide
|
||||
GOVERALLS_BIN := $(GO_BIN)/goveralls
|
||||
LINT_BIN := $(GO_BIN)/gometalinter.v2
|
||||
|
||||
HAVE_DEP := $(shell command -v $(DEP_BIN) 2> /dev/null)
|
||||
HAVE_BTCD := $(shell command -v $(BTCD_BIN) 2> /dev/null)
|
||||
HAVE_GLIDE := $(shell command -v $(GLIDE_BIN) 2> /dev/null)
|
||||
HAVE_GOVERALLS := $(shell command -v $(GOVERALLS_BIN) 2> /dev/null)
|
||||
@ -26,14 +23,15 @@ COMMIT := $(shell git describe --abbrev=40 --dirty)
|
||||
LDFLAGS := -ldflags "-X $(PKG)/build.Commit=$(COMMIT)"
|
||||
|
||||
GLIDE_COMMIT := 84607742b10f492430762d038e954236bbaf23f7
|
||||
BTCD_COMMIT := $(shell cat Gopkg.toml | \
|
||||
grep -A1 $(BTCD_PKG) | \
|
||||
BTCD_COMMIT := $(shell cat go.sum | \
|
||||
grep $(BTCD_PKG) | \
|
||||
tail -n1 | \
|
||||
awk '{ print $$3 }' | \
|
||||
tr -d '"')
|
||||
awk -F " " '{ print $$2 }' | \
|
||||
awk -F "-" '{ print $$3 }' | \
|
||||
awk -F "/" '{ print $$1 }')
|
||||
|
||||
GOBUILD := go build -v
|
||||
GOINSTALL := go install -v
|
||||
GOBUILD := GO111MODULE=on go build -v
|
||||
GOINSTALL := GO111MODULE=on go install -v
|
||||
GOTEST := go test -v
|
||||
|
||||
GOLIST := go list $(PKG)/... | grep -v '/vendor/'
|
||||
@ -93,10 +91,6 @@ all: scratch check install
|
||||
# DEPENDENCIES
|
||||
# ============
|
||||
|
||||
$(DEP_BIN):
|
||||
@$(call print, "Fetching dep.")
|
||||
go get -u $(DEP_PKG)
|
||||
|
||||
$(GLIDE_BIN):
|
||||
@$(call print, "Fetching glide.")
|
||||
go get -d $(GLIDE_PKG)
|
||||
@ -111,10 +105,6 @@ $(LINT_BIN):
|
||||
@$(call print, "Fetching gometalinter.v2")
|
||||
go get -u $(LINT_PKG)
|
||||
|
||||
dep: $(DEP_BIN)
|
||||
@$(call print, "Compiling dependencies.")
|
||||
dep ensure -v
|
||||
|
||||
$(BTCD_DIR):
|
||||
@$(call print, "Fetching btcd.")
|
||||
go get -d github.com/btcsuite/btcd
|
||||
@ -137,10 +127,10 @@ build:
|
||||
|
||||
install:
|
||||
@$(call print, "Installing lnd and lncli.")
|
||||
go install -v -tags="$(PROD_TAGS)" $(LDFLAGS) $(PKG)
|
||||
go install -v -tags="$(PROD_TAGS)" $(LDFLAGS) $(PKG)/cmd/lncli
|
||||
$(GOINSTALL) -tags="$(PROD_TAGS)" $(LDFLAGS) $(PKG)
|
||||
$(GOINSTALL) -tags="$(PROD_TAGS)" $(LDFLAGS) $(PKG)/cmd/lncli
|
||||
|
||||
scratch: dep build
|
||||
scratch: build
|
||||
|
||||
|
||||
# =======
|
||||
@ -219,7 +209,6 @@ clean:
|
||||
.PHONY: all \
|
||||
btcd \
|
||||
default \
|
||||
dep \
|
||||
build \
|
||||
install \
|
||||
scratch \
|
||||
|
Loading…
Reference in New Issue
Block a user