-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (49 loc) · 1.48 KB
/
Makefile
File metadata and controls
65 lines (49 loc) · 1.48 KB
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
# Set Shell to bash, otherwise some targets fail with dash/zsh etc.
SHELL := /bin/bash
# Disable built-in rules
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
.SUFFIXES:
.SECONDARY:
.DEFAULT_GOAL := help
# General variables
include Makefile.vars.mk
export GOEXPERIMENT = jsonv2
.PHONY: help
help: ## Show this help
@grep -E -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: test
test: ## Run tests
go test ./... -race -coverprofile cover.tmp.out
cat cover.tmp.out | grep -v "zz_generated.deepcopy.go" > cover.out
.PHONY: build
build: build-bin build-docker ## All-in-one build
.PHONY: build-bin
build-bin: fmt vet $(BIN_FILENAME) ## Build binary
.PHONY: build-docker
build-docker: build-bin ## Build docker image
$(DOCKER_CMD) build -t $(CONTAINER_IMG) .
.PHONY: generate
generate: ## Generate manifests e.g. CRD, RBAC etc.
go generate ./...
.PHONY: fmt
fmt: ## Run go fmt against code
go fmt ./...
.PHONY: vet
vet: ## Run go vet against code
go vet ./...
.PHONY: lint
lint: fmt vet ## All-in-one linting
@echo 'Check for uncommitted changes ...'
git diff --exit-code
clean: ## Cleans up the generated resources
rm -rf contrib/ dist/ cover.out $(BIN_FILENAME) || true
###
### Assets
###
# Build the binary without running generators
.PHONY: $(BIN_FILENAME)
$(BIN_FILENAME): export CGO_ENABLED = 0
$(BIN_FILENAME):
@echo "GOOS=$$(go env GOOS) GOARCH=$$(go env GOARCH)"
go build -o $(BIN_FILENAME)