forked from NVIDIA/gpu-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (48 loc) · 1.76 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
.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/ubuntu/Dockerfile.ubuntu18.04
DEBUG_DOCKERFILE ?= $(CURDIR)/docker/debug/Dockerfile.debug
DOCKERDEVEL ?= $(CURDIR)/docker/builder.Dockerfile
BIN_NAME ?= gpu-operator
IMAGE ?= nvidia/gpu-operator:latest
BUILDER ?= nvidia/gpu-operator:builder
##### 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
devel:
$(DOCKER) build -t $(BUILDER) -f $(DOCKERDEVEL) .
@echo $(DOCKER) run -it $v $(CURDIR):/go/src/$(PACKAGE) $(BUILDER):devel bash
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)
image:
$(DOCKER) build -t $(IMAGE) -f $(DOCKERFILE) .
debug_image:
$(DOCKER) build -t $(IMAGE) -f $(DEBUG_DOCKERFILE) .