forked from labring/sealos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
145 lines (115 loc) · 4.05 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Copyright © 2022 sealos.
#
# 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.
# ==============================================================================
# Build options
ROOT_PACKAGE=github.com/labring/sealos
VERSION_PACKAGE=github.com/labring/sealos/pkg/version
# ==============================================================================
# Includes
include scripts/make-rules/common.mk # must be the first to include
include scripts/make-rules/golang.mk
include scripts/make-rules/gen.mk
include scripts/make-rules/license.mk
include scripts/make-rules/tools.mk
# ==============================================================================
# Usage
define USAGE_OPTIONS
Options:
DEBUG Whether or not to generate debug symbols. Default is 0.
BINS Binaries to build. Default is all binaries under cmd.
This option is available when using: make {build}(.multiarch)
Example: make build BINS="sealos sealctl"
PLATFORMS Platform to build for. Default is linux_arm64 and linux_amd64.
This option is available when using: make {build}.multiarch
Example: make build.multiarch PLATFORMS="linux_arm64 linux_amd64"
V Set to 1 enable verbose build. Default is 0.
endef
export USAGE_OPTIONS
# ==============================================================================
# Targets
.DEFAULT_GOAL = build
## build: Build source code for host platform.
.PHONY: build
build:
@$(MAKE) go.build
## build.multiarch: Build source code for multiple platforms. See option PLATFORMS.
.PHONY: build.multiarch
build.multiarch:
@$(MAKE) go.build.multiarch
# ## image: Build docker images for host platform.
# .PHONY: image
# image:
# @$(MAKE) image.build
# ## image.multiarch: Build docker images for multiple platforms. See option PLATFORMS.
# .PHONY: image.multiarch
# image.multiarch:
# @$(MAKE) image.build.multiarch
# ## push: Push docker images for host platform to registry.
# .PHONY: push
# push:
# @$(MAKE) image.push
# ## push.multiarch: Push docker images for multiple platforms to registry. See option PLATFORMS.
# .PHONY: push.multiarch
# push.multiarch:
# @$(MAKE) image.push.multiarch
## lint: Check syntax and styling of go sources.
.PHONY: lint
lint:
@$(MAKE) go.lint
## format: Gofmt (reformat) package sources.
.PHONY: format
format:
@$(MAKE) go.format
## coverage: Run unit tests and output test coverage.
.PHONY: coverage
coverage:
@$(MAKE) go.coverage
## verify-license: Verify the license headers for all files.
.PHONY: verify-license
verify-license:
@$(MAKE) license.verify
## add-license: Ensure source code files have license headers.
.PHONY: add-license
add-license:
@$(MAKE) license.add
##license: Add license header to all files.
.PHONY: license
license:
@$(MAKE) license.add
.PHONY: license.controller
license.controller:
@$(MAKE) license.controller.add
## gen: Generate all necessary files.
.PHONY: gen
gen:
@$(MAKE) gen.run
## tools: Install dependent tools.
.PHONY: tools
tools:
@$(MAKE) tools.install
## clean: Remove all files that are created by building.
.PHONY: clean
clean:
@echo "===========> Cleaning all build output"
@-rm -vrf $(OUTPUT_DIR) $(BIN_DIR)
## update-contrib: Update list of contributors.
.PHONY: update-contrib
update-contrib:
@git log --format='%aN <%aE>' | sort -uf > CONTRIBUTORS
## help: Show this help info.
.PHONY: help
help: Makefile
@echo -e "\nUsage: make <TARGETS> <OPTIONS> ...\n\nTargets:"
@sed -n 's/^##//p' $< | awk -F':' '{printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' | sed -e 's/^/ /'
@echo "$$USAGE_OPTIONS"