forked from rojkov/intel-device-plugins-for-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (40 loc) · 1.46 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
GO := go
GOFMT := gofmt
GOCYCLO := gocyclo
pkgs = $(shell $(GO) list ./... | grep -v vendor)
cmds = $(shell ls cmd)
all: build
format:
@report=`$(GOFMT) -s -d -w $$(find cmd pkg -name \*.go)` ; if [ -n "$$report" ]; then echo "$$report"; exit 1; fi
vet:
@$(GO) vet -v -shadow $(pkgs)
cyclomatic-check:
@report=`$(GOCYCLO) -over 15 cmd pkg`; if [ -n "$$report" ]; then echo "Complexity is over 15 in"; echo $$report; exit 1; fi
test:
ifndef WHAT
@$(GO) test -race -coverprofile=coverage.txt -covermode=atomic $(pkgs)
else
@cd $(WHAT) && \
$(GO) test -v -cover -coverprofile cover.out || rc=1; \
$(GO) tool cover -html=cover.out -o coverage.html; \
rm cover.out; \
echo "Coverage report: file://$$(realpath coverage.html)"; \
exit $$rc
endif
lint:
@rc=0 ; for f in $$(find -name \*.go | grep -v \.\/vendor) ; do golint -set_exit_status $$f || rc=1 ; done ; exit $$rc
$(cmds):
cd cmd/$@; go build
build: $(cmds)
clean:
@for cmd in $(cmds) ; do pwd=$(shell pwd) ; cd cmd/$$cmd ; go clean ; cd $$pwd ; done
TAG?=$(shell git rev-parse HEAD)
images = $(shell ls build/docker/*.Dockerfile | sed 's/.*\/\(.\+\)\.Dockerfile/\1/')
$(images):
@build/docker/build-image.sh $@ $(BUILDER)
images: $(images)
demos = $(shell cd demo/ && ls -d */ | sed 's/\(.\+\)\//\1/g')
$(demos):
@cd demo/ && ./build-image.sh $@ $(BUILDER)
demos: $(demos)
.PHONY: all format vet cyclomatic-check test lint build images $(cmds) $(images)