generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
62 lines (48 loc) · 1.38 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
BUILDOS := $(shell go env GOOS)
BUILDARCH := $(shell go env GOARCH)
TESTOS ?= $(BUILDOS)
TESTARCH ?= $(BUILDARCH)
TARGETOS ?= $(TESTOS)
TARGETARCH ?= $(TESTARCH)
# build (used by Dockerfile)
.PHONY: build
build: build-controller build-webhook
.PHONY: build-controller
build-controller:
@CGO_ENABLED=0 GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -o ./bin/controller ./cmd/controller
.PHONY: build-webhook
build-webhook:
@CGO_ENABLED=0 GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go build -o ./bin/webhook ./cmd/webhook
# build and install executables
.PHONY: install
install: install-controller install-webhook
.PHONY: install-controller
install-controller:
@CGO_ENABLED=0 GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go install ./cmd/controller
.PHONY: install-webhook
install-webhook:
@CGO_ENABLED=0 GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) go install ./cmd/webhook
# run unit tests
.PHONY: test
test: test-controller test-webhook
.PHONY: test-controller
test-controller:
@go test -v ./internal/controller
.PHONY: test-webhook
test-webhook:
@go test -v ./internal/admission
# generate code
.PHONY: generate
generate:
@hack/update-codegen.sh --parallel
# format code
.PHONY: format
format:
@go fmt ./cmd/... ./internal/... ./pkg/apis/... ./test...
# prepare local developement environment
.PHONY: local-generate
local-generate:
@hack/generate-local.sh
.PHONY: local-setup
local-setup:
@hack/setup-local.sh