-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
41 lines (30 loc) · 782 Bytes
/
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
NAME := dflint
VERSION := v0.0.4
REVISION := $(shell git rev-parse --short HEAD)
SRCS := *.go rule/*.go
PKGS := $(shell go list ./...)
LDFLAGS := "-X main.Version=$(VERSION)"
all: $(NAME)
$(NAME): $(SRCS)
go build -ldflags $(LDFLAGS) -o $(NAME)
dep:
ifeq ($(shell command -v dep 2> /dev/null),)
go get github.com/golang/dep/cmd/dep
endif
deps: dep
dep ensure
test:
go test -cover $(PKGS)
test-cover:
echo 'mode: atomic' > cover-all.out
$(foreach pkg, $(PKGS), \
go test -coverprofile=cover.out -covermode=atomic -v $(pkg); \
tail -n +2 cover.out >> cover-all.out; \
)
go tool cover -func=cover-all.out
clean:
rm -rf $(NAME) cover-all.out cover.out bin vendor
force: clean all
install:
go install
.PHONY: force clean test-cover test all deps dep