forked from kubeedge/edgemesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
120 lines (103 loc) · 2.63 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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# Copyright 2021 The KubeEdge Authors.
#
# 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.
GOPATH?=$(shell go env GOPATH)
# make binaries
BINARIES=edgemesh
.EXPORT_ALL_VARIABLES:
OUT_DIR ?= _output/local
define ALL_HELP_INFO
# Build code.
#
# Args:
# WHAT: binary names to build. support: $(BINARIES)
# the build will produce executable files under $(OUT_DIR)
# If not specified, "everything" will be built.
#
# Example:
# make
# make all
# make all HELP=y
# make all WHAT=edgemesh
# make all WHAT=edgemesh GOLDFLAGS="" GOGCFLAGS="-N -l"
# Note: Specify GOLDFLAGS as an empty string for building unstripped binaries, specify GOGCFLAGS
# to "-N -l" to disable optimizations and inlining, this will be helpful when you want to
# use the debugging tools like delve. When GOLDFLAGS is unspecified, it defaults to "-s -w" which strips
# debug information, see https://golang.org/cmd/link for other flags.
endef
.PHONY: all
ifeq ($(HELP),y)
all: clean
@echo "$$ALL_HELP_INFO"
else
all: verify-golang
EDGEMESH_OUTPUT_SUBPATH=$(OUT_DIR) hack/make-rules/build.sh $(WHAT)
endif
define VERIFY_HELP_INFO
# verify golang,vendor
#
# Example:
# make verify
endef
.PHONY: verify
ifeq ($(HELP),y)
verify:
@echo "$$VERIFY_HELP_INFO"
else
verify:verify-golang verify-vendor verify-vendor-licenses
endif
.PHONY: verify-golang
verify-golang:
hack/verify-golang.sh
.PHONY: verify-vendor
verify-vendor:
hack/verify-vendor.sh
.PHONY: verify-vendor-licenses
verify-vendor-licenses:
hack/verify-vendor-licenses.sh
define LINT_HELP_INFO
# run golang lint check.
#
# Example:
# make lint
# make lint HELP=y
endef
.PHONY: lint
ifeq ($(HELP),y)
lint:
@echo "$$LINT_HELP_INFO"
else
lint:
hack/make-rules/lint.sh
endif
define CLEAN_HELP_INFO
# Clean up the output of make.
#
# Example:
# make clean
# make clean HELP=y
#
endef
.PHONY: clean
ifeq ($(HELP),y)
clean:
@echo "$$CLEAN_HELP_INFO"
else
clean:
hack/make-rules/clean.sh
endif
IMAGE_TAG ?= $(shell git describe --tags)
GO_LDFLAGS='$(shell hack/make-rules/version.sh)'
.PHONY: images
images:
docker build --build-arg GO_LDFLAGS=${GO_LDFLAGS} -t kubeedge/edgemesh:${IMAGE_TAG} -f build/Dockerfile .