-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile.common
37 lines (31 loc) · 1.87 KB
/
Makefile.common
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
PROCESSOR=2
VERSION=4.2.5.0
NAME=obshell
RELEASE=0
DIST=0
PWD ?= $(shell pwd)
PROXY=https://goproxy.cn
GO := GO111MODULE=on GOPROXY=${PROXY},direct go
BUILD_FLAG := -p $(PROCESSOR)
GOBUILD := $(GO) build $(BUILD_FLAG)
GOBUILDCOVERAGE := $(GO) test -covermode=count -coverpkg="../..." -c .
GOCOVERAGE_FILE := tests/coverage.out
GOCOVERAGE_REPORT := tests/coverage-report
GOTEST := OB_AGENT_CONFIG_PATH=$(PWD) $(GO) test -tags test -covermode=count -coverprofile=$(GOCOVERAGE_FILE) -p $(PROCESSOR)
GO_RACE_FLAG =-race
LDFLAGS += -X "github.com/oceanbase/obshell/agent/constant.VERSION=${VERSION}"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/constant.RELEASE=${RELEASE}"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/constant.DIST=${DIST}"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.BuildTime=$(shell date +"%b %d %Y %H:%M:%S %Z")"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.BuildGoVersion=$(shell go version)"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.GitCommitId=$(shell git rev-parse HEAD)"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.GitShortCommitId=$(shell git rev-parse --short HEAD)"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.GitCommitTime=$(shell git log -1 --format=%cd)"
LDFLAGS += -X "github.com/oceanbase/obshell/agent/config.BuildFlags=${BUILD_FLAG}"
LDFLAGS_DEBUG = -X "github.com/oceanbase/obshell/agent/config.Mode=debug"
LDFLAGS_RELEASE = -X "github.com/oceanbase/obshell/agent/config.Mode=release"
OBSHELL_LDFLAGS = $(LDFLAGS) -X "github.com/oceanbase/obshell/agent/config.CurProcess=obshell"
GOFILES ?= $(shell git ls-files '*.go')
GOTEST_PACKAGES = $(shell go list ./... | grep -v -f tests/excludes.txt)
UNFMT_FILES ?= $(shell gofmt -l -s $(filter-out , $(GOFILES)))