forked from openshift/sriov-network-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
80 lines (61 loc) · 2.27 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
73
74
75
76
77
78
79
80
CURPATH=$(PWD)
TARGET_DIR=$(CURPATH)/build/_output
KUBECONFIG?=$(HOME)/.kube/config
GOLIST=go list
GOFMT=gofmt
BUILD_GOPATH=$(TARGET_DIR):$(TARGET_DIR)/vendor:$(CURPATH)/cmd
IMAGE_BUILDER_OPTS=
IMAGE_BUILDER?=imagebuilder
IMAGE_BUILD=$(IMAGE_BUILDER)
export IMAGE_TAG_CMD?=docker tag
export APP_NAME=sriov-network-operator
APP_REPO=github.com/openshift/$(APP_NAME)
TARGET=$(TARGET_DIR)/bin/$(APP_NAME)
export IMAGE_TAG=quay.io/pliurh/$(APP_NAME):latest
MAIN_PKG=cmd/manager/main.go
export NAMESPACE?=sriov-network-operator
PKGS=$(shell go list ./... | grep -v -E '/vendor/|/test|/examples')
# go source files, ignore vendor directory
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
.PHONY: all operator-sdk build clean fmt gendeepcopy test-unit test-e2e run
all: build #check install
operator-sdk:
@if ! type -p operator-sdk ; \
then if [ ! -d $(GOPATH)/src/github.com/operator-framework/operator-sdk ] ; \
then git clone https://github.com/operator-framework/operator-sdk --branch master $(GOPATH)/src/github.com/operator-framework/operator-sdk ; \
fi ; \
cd $(GOPATH)/src/github.com/operator-framework/operator-sdk ; \
make dep ; \
make install ; \
fi
all: build plugins
build: _build-manager _build-sriov-network-config-daemon
_build-%:
WHAT=$* hack/build-go.sh
run:
hack/run-locally.sh
clean:
@rm -rf $(TARGET_DIR)
# image: imagebuilder
# @if [ $${USE_IMAGE_STREAM:-false} = false ] && [ $${SKIP_BUILD:-false} = false ] ; \
# then $(IMAGE_BUILDER) -t $(IMAGE_TAG) . $(IMAGE_BUILDER_OPTS) ; \
# fi
fmt: ; $(info running gofmt...) @ ## Run gofmt on all source files
@ret=0 && for d in $$($(GOLIST) -f '{{.Dir}}' ./... | grep -v /vendor/); do \
$(GOFMT) -l -w $$d/*.go || ret=$$? ; \
done ; exit $$ret
gencode: operator-sdk
@operator-sdk generate k8s
@operator-sdk generate openapi
deploy-setup:
@EXCLUSIONS=() hack/deploy-setup.sh sriov-network-operator
# test-unit:
# @go test -v $(PKGS)
test-e2e: operator-sdk
@EXCLUSIONS=() hack/deploy-setup.sh sriov-network-operator && operator-sdk test local ./test/e2e --go-test-flags "-v" --namespace sriov-network-operator --no-setup
@hack/undeploy.sh sriov-network-operator
undeploy:
@hack/undeploy.sh sriov-network-operator
_plugin-%:
@hack/build-plugins.sh $*
plugins: _plugin-intel _plugin-generic