forked from zilliztech/milvus-backup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (29 loc) · 836 Bytes
/
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
# Variables
BINARY_NAME=milvus-backup
PKG := github.com/zilliztech/milvus-backup
VERSION=$(shell git describe --tags --always)
COMMIT=$(shell git rev-parse --short HEAD)
DATE=$(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
LDFLAGS += -X "$(PKG)/version.Version=$(VERSION)"
LDFLAGS += -X "$(PKG)/version.Commit=$(COMMIT)"
LDFLAGS += -X "$(PKG)/version.Date=$(DATE)"
# Default target
all: gen build
test:
@echo "Running unit tests..."
@go test --race ./...
# Build the binary
build:
@echo "Building Backup binary..."
@echo "Version: $(VERSION)"
@echo "Commit: $(COMMIT)"
@echo "Date: $(DATE)"
@GO111MODULE=on CGO_ENABLED=0 go build -ldflags '$(LDFLAGS)' -o $(BINARY_NAME)
gen:
./scripts/gen_swag.sh
./scripts/gen_proto.sh
fmt:
@echo Formatting code...
@goimports -w --local $(PKG) ./
@echo Format code done
.PHONY: all build gen