-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
55 lines (45 loc) · 1.31 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
SHELL = bash
NOMAD_PLUGIN_DIR ?= /tmp/nomad-plugins
.PHONY: clean
clean:
@echo "==> Cleanup previous build"
rm -f $(NOMAD_PLUGIN_DIR)/nomad-device-nvidia
.PHONY: copywrite
copywrite:
@echo "==> Checking copywrite headers"
copywrite --config .copywrite.hcl headers --spdx "MPL-2.0"
.PHONY: compile
compile: clean
@echo "==> Compile nvidia driver plugin ..."
mkdir -p $(NOMAD_PLUGIN_DIR)
go build -race -trimpath -o $(NOMAD_PLUGIN_DIR)/nomad-device-nvidia cmd/main.go
.PHONY: test
test:
@echo "==> Running tests ..."
go test -v -race ./...
.PHONY: lint
lint:
@echo "==> Lint nvidia driver ..."
go vet ./...
golangci-lint --timeout=5m run
.PHONY: hack
hack: compile
hack:
@echo "==> Run dev Nomad with nomad plugin"
sudo nomad agent -dev -plugin-dir=$(NOMAD_PLUGIN_DIR)
# CRT release compilation
dist/%/nomad-device-nvidia: GO_OUT ?= $@
dist/%/nomad-device-nvidia:
@echo "==> RELEASE BUILD of $@ ..."
GOOS=linux GOARCH=$(lastword $(subst _, ,$*)) \
go build -trimpath -o $(GO_OUT) cmd/main.go
# CRT release packaging (zip only)
.PRECIOUS: dist/%/nomad-device-nvidia
dist/%.zip: dist/%/nomad-device-nvidia
@echo "==> RELEASE PACKAGING of $@ ..."
@cp LICENSE $(dir $<)LICENSE.txt
zip -j $@ $(dir $<)*
# CRT version generation
.PHONY: version
version:
@$(CURDIR)/version/generate.sh version/version.go version/version.go