forked from c-bata/kube-prompt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
48 lines (41 loc) · 1.3 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
NAME := kube-prompt
VERSION := $(shell git describe --tags --abbrev=0)
REVISION := $(shell git rev-parse --short HEAD)
LDFLAGS := -X 'main.version=$(VERSION)' \
-X 'main.revision=$(REVISION)'
GOIMPORTS ?= goimports
GOCILINT ?= golangci-lint
GO ?= GO111MODULE=on go
.DEFAULT_GOAL := help
.PHONY: fmt
fmt: ## Formatting source codes.
@$(GOIMPORTS) -w ./kube
.PHONY: lint
lint: ## Run golint and go vet.
@$(GOCILINT) run --no-config --disable-all --enable=goimports --enable=misspell ./...
.PHONY: test
test: ## Run the tests.
@$(GO) test ./...
.PHONY: build
build: main.go ## Build a binary.
$(GO) build -ldflags "$(LDFLAGS)"
.PHONY: code-gen
code-gen: ## Generate source codes.
./_tools/codegen.sh
.PHONY: cross
cross: main.go ## Build binaries for cross platform.
mkdir -p pkg
@# darwin
@for arch in "amd64" "386"; do \
GOOS=darwin GOARCH=$${arch} make build; \
zip pkg/kube-prompt_$(VERSION)_darwin_$${arch}.zip kube-prompt; \
done;
@# linux
@for arch in "amd64" "386" "arm64" "arm"; do \
GOOS=linux GOARCH=$${arch} make build; \
zip pkg/kube-prompt_$(VERSION)_linux_$${arch}.zip kube-prompt; \
done;
.PHONY: help
help: ## Show help text
@echo "Commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'