forked from NVIDIA/gpu-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (46 loc) · 1.63 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
.PHONY: all build devel image verify fmt lint test clean
.DEFAULT_GOAL := all
##### Global definitions #####
export MAKE_DIR ?= $(CURDIR)/mk
include $(MAKE_DIR)/common.mk
##### Global variables #####
DOCKERFILE ?= $(CURDIR)/docker/Dockerfile.ubi8.prod
DOCKERFILE_DEVEL ?= $(CURDIR)/docker/Dockerfile.devel
BIN_NAME ?= gpu-operator
IMAGE ?= nvidia/gpu-operator
VERSION ?= 1.1.2
TAG ?= latest
TAG_DEVEL ?= devel
##### File definitions #####
PACKAGE := github.com/NVIDIA/gpu-operator
MAIN_PACKAGE := $(PACKAGE)/cmd/manager
BINDATA := $(PACKAGE)/pkg/manifests/bindata.go
##### Flags definitions #####
CGO_ENABLED := 0
GOOS := linux
##### Public rules #####
all: build verify
verify: fmt lint test vet assign
build:
GOOS=$(GOOS) CGO_ENABLED=$(CGO_ENABLED) go build -o $(BIN_NAME) $(MAIN_PACKAGE)
fmt:
find . -not \( \( -wholename './.*' -o -wholename '*/vendor/*' \) -prune \) -name '*.go' \
| sort -u | xargs gofmt -s -l -d > fmt.out
if [ -s fmt.out ]; then cat fmt.out; rm fmt.out; exit 1; else rm fmt.out; fi
lint:
find . -not \( \( -wholename './.*' -o -wholename '*/vendor/*' \) -prune \) -name '*.go' \
| sort -u | xargs golint -set_exit_status
vet:
go vet $(PACKAGE)/...
test:
go test $(PACKAGE)/cmd/... $(PACKAGE)/pkg/... -coverprofile cover.out
assign:
find . -not \( \( -wholename './.*' -o -wholename '*/vendor/*' \) -prune \) -name '*.go' \
| sort -u | xargs ineffassign
clean:
go clean
rm -f $(BIN)
prod-image:
$(DOCKER) build --build-arg VERSION=$(VERSION) -t $(IMAGE):$(TAG) -f $(DOCKERFILE) .
devel-image:
$(DOCKER) build -t $(IMAGE):$(TAG_DEVEL) -f $(DOCKERFILE_DEVEL) .