-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile.common
94 lines (75 loc) · 3.71 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
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright 2023 Huawei Cloud Computing Technologies Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
export GOROOT=$(shell go env GOROOT)
export GOPATH=$(shell go env GOPATH)
export GOOS=$(shell go env GOOS)
export GOARCH=$(shell go env GOARCH)
export PATH := $(PATH):$(GOROOT)/bin:$(GOPATH)/bin
GO := GO111MODULE=on go
GOTEST := $(GO) test
PYTHON := python
STATICCHECK := staticcheck
FAILPOINT_ENABLE := find $$PWD/ -type d | grep -vE "(\.git|\.github|\.tests)" | xargs failpoint-ctl enable
FAILPOINT_DISABLE := find $$PWD/ -type d | grep -vE "(\.git|\.github|\.tests)" | xargs failpoint-ctl disable
PACKAGE_LIST_OPEN_GEMINI_TESTS := $(GO) list ./... | grep -vE "tests|open_src\/github.com\/hashicorp"
PACKAGES_OPEN_GEMINI_TESTS ?= $$($(PACKAGE_LIST_OPEN_GEMINI_TESTS))
COPYRIGHT_EXCEPT := "open_src|tests|lib/netstorage/data/data.pb.go|lib/statisticsPusher/statistics/handler_statistics.go|app/ts-meta/meta/snapshot.go|engine/index/tsi/tag_filters.go|engine/index/tsi/tag_filter_test.go|engine/index/mergeindex/item.go|lib/config/openGemini_dir.go"
COPYRIGHT_GOFILE := $$(find . -name '*.go' | grep -vE $(COPYRIGHT_EXCEPT))
COPYRIGHT_HEADER := "Copyright 2022|2023 Huawei Cloud Computing Technologies Co., Ltd."
PROTOC_ZIP_LINUX=protoc-3.14.0-linux-x86_64.zip
PROTOC_ZIP_MACOS=protoc-3.14.0-osx-x86_64.zip
PROTOC_ZIP_WINDOWS=protoc-3.14.0-win64.zip
install-goimports-reviser:
@$(GO) install github.com/incu6us/goimports-reviser/[email protected]
install-staticcheck:
@$(GO) install honnef.co/go/tools/cmd/[email protected]
install-golangci-lint:
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$($(GO) env GOPATH)/bin v1.53.3
install-failpoint:
@$(GO) install github.com/pingcap/failpoint/failpoint-ctl
install-tmpl:
@$(GO) install github.com/benbjohnson/[email protected]
install-goyacc:
@$(GO) install golang.org/x/tools/cmd/[email protected]
install-protoc:
@VERSION=$$(protoc --version); if [ "$$VERSION" = "libprotoc 3.14.0" ]; then exit 0; fi; \
if [ $$(uname -s) = "Linux" ]; then \
make install-protoc-linux; \
elif [ $$(uname -s) = "Darwin" ]; then \
make install-protoc-darwin; \
else \
echo "unknown arch"; \
fi
install-protoc-linux:
@curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$(PROTOC_ZIP_LINUX)
@sudo unzip -o $(PROTOC_ZIP_LINUX) -d /usr/local bin/protoc
@sudo unzip -o $(PROTOC_ZIP_LINUX) -d /usr/local 'include/*'
@sudo chmod +x /usr/local/bin/protoc
@rm -f $(PROTOC_ZIP_LINUX)
install-protoc-darwin:
@curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$(PROTOC_ZIP_MACOS)
@sudo unzip -X -o $(PROTOC_ZIP_MACOS) -d /usr/local bin/protoc
@sudo unzip -o $(PROTOC_ZIP_MACOS) -d /usr/local 'include/*'
@sudo chmod +x /usr/local/bin/protoc
@rm -f $(PROTOC_ZIP_MACOS)
install-protoc-windows:
@curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$(PROTOC_ZIP_WINDOWS)
@powershell.exe Expand-Archive -Path protoc-3.14.0-win64.zip -DestinationPath $(GOPATH)\protobuf -Force
@del $(PROTOC_ZIP_WINDOWS)
install-protoc-gen-gogo:
@$(GO) install github.com/gogo/protobuf/protoc-gen-gogo@latest
failpoint-enable:
@$(FAILPOINT_ENABLE)
failpoint-disable:
@$(FAILPOINT_DISABLE)