-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (45 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PKG := github.com/ExchangeUnion/xud-simnet-bot
GO_BIN := ${GOPATH}/bin
GOTEST := GO111MODULE=on go test -v
GOBUILD := GO111MODULE=on go build -v
GOINSTALL := GO111MODULE=on go install -v
GOLIST := go list -deps $(PKG)/... | grep '$(PKG)'| grep -v '/vendor/'
COMMIT := $(shell git log --pretty=format:'%h' -n 1)
LDFLAGS := -ldflags "-X $(PKG)/build.Commit=$(COMMIT)"
LINT_PKG := github.com/golangci/golangci-lint/cmd/golangci-lint
LINT_BIN := $(GO_BIN)/golangci-lint
LINT = $(LINT_BIN) run -v
XARGS := xargs -L 1
GREEN := "\\033[0;32m"
NC := "\\033[0m"
define print
echo $(GREEN)$1$(NC)
endef
default: build
#
# Dependencies
#
$(LINT_BIN):
@$(call print, "Fetching linter")
go get -u $(LINT_PKG)
dependencies: $(LINT_BIN)
go mod vendor
#
# Building
#
build:
@$(call print, "Building xud-simnet-bot")
$(GOBUILD) -o xud-simnet-bot $(LDFLAGS) $(PKG)
install:
@$(call print, "Installing xud-simnet-bot")
$(GOINSTALL) $(LDFLAGS) $(PKG)
#
# Utils
#
fmt:
@$(call print, "Formatting source")
gofmt -l -s -w .
lint: $(LINT_BIN)
@$(call print, "Linting source")
$(LINT)
.PHONY: build