~ubuntu-branches/debian/experimental/go-cve-dictionary/experimental

1 by Nobuhiro Iwamatsu
Import upstream version 0.1.1+git20171025.0.a64c5fc
1
.PHONY: \
2
	dep \
3
	depup \
4
	build \
5
	install \
6
	all \
7
	vendor \
8
	lint \
9
	vet \
10
	fmt \
11
	fmtcheck \
12
	pretest \
13
	test \
14
	integration \
15
	cov \
16
	clean
17
18
SRCS = $(shell git ls-files '*.go')
19
PKGS =  ./commands ./config ./db ./jvn ./log ./models ./nvd ./server
20
VERSION := $(shell git describe --tags --abbrev=0)
21
REVISION := $(shell git rev-parse --short HEAD)
22
LDFLAGS := -X 'main.version=$(VERSION)' \
23
	-X 'main.revision=$(REVISION)'
24
25
all: dep build test
26
27
dep:
28
	go get -u github.com/golang/dep/...
29
	dep ensure
30
31
depup:
32
	go get -u github.com/golang/dep/...
33
	dep ensure -update
34
35
build: main.go dep
36
	go build -ldflags "$(LDFLAGS)" -o go-cve-dictionary $<
37
38
install: main.go dep
39
	go install -ldflags "$(LDFLAGS)"
40
41
all: test
42
43
lint:
44
	@ go get -v github.com/golang/lint/golint
45
	$(foreach file,$(SRCS),golint $(file) || exit;)
46
47
vet:
48
	$(foreach pkg,$(PKGS),go vet $(pkg);)
49
50
fmt:
51
	gofmt -w $(SRCS)
52
53
fmtcheck:
54
	$(foreach file,$(SRCS),gofmt -d $(file);)
55
56
pretest: lint vet fmtcheck
57
58
test: pretest
59
	$(foreach pkg,$(PKGS),go test -v $(pkg) || exit;)
60
61
integration:
62
	go test -tags docker_integration -run TestIntegration -v
63
64
cov:
65
	@ go get -v github.com/axw/gocov/gocov
66
	@ go get golang.org/x/tools/cmd/cover
67
	gocov test | gocov report
68
69
clean:
70
	$(foreach pkg,$(PKGS),go clean $(pkg) || exit;)
71