forked from lindb/lindb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (37 loc) · 1.64 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
.PHONY: help build test deps pb clean
# Ref: https://gist.github.com/prwhite/8168133
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} \
/^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
build: ## Build executable files. (Args: GOOS=$(go env GOOS) GOARCH=$(go env GOARCH))
cd web/ && make web_build
env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o 'bin/broker' $(LDFLAGS) ./cmd/broker/
# env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o 'bin/cli' $(LDFLAGS) ./cmd/cli/
env GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o 'bin/stroage' $(LDFLAGS) ./cmd/storage/
GOLANGCI_LINT_VERSION ?= "latest"
generate:
go list ./... | grep -v '/vendor/' | xargs go generate
test: ## Run test cases. (Args: GOLANGCI_LINT_VERSION=latest)
if [ ! -e ./bin/golangci-lint ]; then \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s $(GOLANGCI_LINT_VERSION); \
fi
./bin/golangci-lint run
GO111MODULE=on go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
deps: ## Update vendor.
go mod verify
go mod tidy -v
rm -rf vendor
go mod vendor -v
pb: ## generate pb file.
./generate_pb.sh
clean: ## Clean up useless files.
rm -rf bin
cd web/ && make web_clean
find . -type f -name '*.out' -exec rm -f {} +
find . -type f -name '.DS_Store' -exec rm -f {} +
find . -type f -name '*.test' -exec rm -f {} +
find . -type f -name '*.prof' -exec rm -f {} +
find . -type s -name 'localhost:*' -exec rm -f {} +
find . -type s -name '127.0.0.1:*' -exec rm -f {} +