-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
72 lines (53 loc) · 1.79 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
REGISTRY ?= quay.io/kubevirt
IMAGE_TAG ?= latest
IMAGE_GIT_TAG ?= $(shell git describe --abbrev=8 --tags)
BIN_DIR = $(CURDIR)/build/_output/bin/
export GOPROXY=direct
export GOFLAGS=-mod=vendor
export GOROOT=$(BIN_DIR)/go/
export GOBIN=$(GOROOT)/bin/
export PATH := $(GOROOT)/bin:$(PATH)
export GO := $(GOBIN)/go
OCI_BIN ?= $(shell if hash podman 2>/dev/null; then echo podman; elif hash docker 2>/dev/null; then echo docker; fi)
TLS_SETTING := $(if $(filter $(OCI_BIN),podman),"--tls-verify=false",)
GINKGO ?= $(GOBIN)/ginkgo
COMPONENTS = $(sort \
$(subst /,-,\
$(patsubst cmd/%/,%,\
$(dir \
$(shell find cmd/ -type f -name '*.go')))))
all: build
$(GO):
hack/install-go.sh $(BIN_DIR)
$(GINKGO): go.mod
$(MAKE) tools
build: marker manifests format
format: $(GO)
$(GO) fmt ./pkg/... ./cmd/... ./tests/...
$(GO) vet ./pkg/... ./cmd/... ./tests/...
functest: $(GINKGO)
GINKGO=$(GINKGO) hack/build-func-tests.sh
GINKGO=$(GINKGO) hack/functests.sh
marker: $(GO)
hack/version.sh > $(BIN_DIR)/.version
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GO) build -o $(BIN_DIR)/marker github.com/kubevirt/bridge-marker/cmd/marker
docker-build: marker
$(OCI_BIN) build -t ${REGISTRY}/bridge-marker:${IMAGE_TAG} ./build
docker-push:
$(OCI_BIN) push ${TLS_SETTING} ${REGISTRY}/bridge-marker:${IMAGE_TAG}
$(OCI_BIN) tag ${REGISTRY}/bridge-marker:${IMAGE_TAG} ${REGISTRY}/bridge-marker:${IMAGE_GIT_TAG}
$(OCI_BIN) push ${TLS_SETTING} ${REGISTRY}/bridge-marker:${IMAGE_GIT_TAG}
manifests:
./hack/build-manifests.sh
cluster-up:
./cluster/up.sh
cluster-down:
./cluster/down.sh
cluster-sync: build
./cluster/sync.sh
vendor: $(GO)
$(GO) mod tidy
$(GO) mod vendor
tools: $(GO)
./hack/install-tools.sh
.PHONY: build format docker-build docker-push manifests cluster-up cluster-down cluster-sync vendor marker tools