# 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_TOOLS ?= golangci-lint goimports addlicense deepcopy-gen conversion-gen upx .PHONY: tools.install tools.install: $(addprefix tools.install., $(BUILD_TOOLS)) .PHONY: tools.install.% tools.install.%: @echo "===========> Installing $*" @$(MAKE) install.$* .PHONY: tools.verify.% tools.verify.%: @if [ ! -f $(TOOLS_DIR)/$* ]; then GOBIN=$(TOOLS_DIR) $(MAKE) tools.install.$*; fi .PHONY: install.golangci-lint install.golangci-lint: @$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest .PHONY: install.goimports install.goimports: @$(GO) install golang.org/x/tools/cmd/goimports@latest .PHONY: install.addlicense install.addlicense: @$(GO) install github.com/google/addlicense@latest .PHONY: install.deepcopy-gen install.deepcopy-gen: @$(GO) install k8s.io/code-generator/cmd/deepcopy-gen@latest .PHONY: install.conversion-gen install.conversion-gen: @$(GO) install k8s.io/code-generator/cmd/conversion-gen@latest # upx platform is NOT relevant to cross-compiling platforms .PHONY: install.upx install.upx: @wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-$(shell go env GOARCH)_$(GOOS).tar.xz @tar xf upx*.tar.xz @sudo cp upx*/upx $(TOOLS_DIR) @rm -rf upx*