-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (40 loc) · 1.34 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
# Go related variables.
GOCMD=go
GOBUILD=$(GOCMD) build
GOBASE=$(shell pwd)
GOBIN=$(GOBASE)/bin
APPNAME=lending
VERSION := $(shell echo $(shell git describe --always --tag) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
ldflags = -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.ServerName=lendingD \
-X github.com/cosmos/cosmos-sdk/version.ClientName=lendingCLI \
-X github.com/cosmos/cosmos-sdk/version.Name=lendingnetwork \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
ldflags += $(LDFLAGS)
ldflags := $(strip $(ldflags))
BUILD_FLAGS := -ldflags '$(ldflags)'
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
.PHONY: help
help: ## Print help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "%-18s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: build
build: ## Build bin
@$(GOBUILD) -o $(GOBIN)/$(APPNAME) $(BUILD_FLAGS) ./app
.PHONY: simplify
simplify:
@gofmt -s -l -w $(SRC)
.PHONY: run-develop
run-develop: ## Run develop app
@$(GOBIN)/$(APPNAME) --config develop.json
.PHONY: clean
clean: ## Remove all binaries
@rm -f $(GOBIN)/*
.PHONY: tidy
tidy: ## Tidy packages
$(GOCMD) mod tidy
.PHONY: test
test:
go test ./... -v -coverprofile .coverage.txt
go tool cover -func .coverage.txt
$(echo $(git describe --tags) | sed 's/^v//')