forked from stevejefferson/trac2gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
81 lines (61 loc) · 1.7 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
75
76
77
78
79
80
81
# go installation
GOPATH=$(HOME)/go
GOBINDIR=$(GOPATH)/bin
# commands
GOCMD=go
GOINSTALL=$(GOCMD) install
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GOMOD=$(GOCMD) mod
MOCKGEN=$(GOBINDIR)/mockgen
BINARY_NAME=trac2gitea
PACKAGES=$(shell go list ./...)
ROOTPACKAGE=github.com/stevejefferson/trac2gitea
MOCKFILES=\
mock_markdown/converter.go \
accessor/mock_gitea/accessor.go \
accessor/mock_trac/accessor.go
.PHONY: all install build test
all: build test
install: build
$(GOINSTALL)
test: build mocks
$(GOTEST) ./...
build: mocks
$(GOBUILD) -o $(BINARY_NAME) -v
.PHONY: allclean clean
allclean: mockclean clean
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
.PHONY: alldeps deps
alldeps: deps mockdeps lintdeps
deps:
$(GOGET) github.com/go-ini/ini
$(GOGET) github.com/mattn/go-sqlite3
$(GOGET) github.com/go-sql-driver/mysql
$(GOGET) github.com/spf13/pflag
$(GOGET) gopkg.in/src-d/go-git.v4
.PHONY: mocks mockdeps mockclean
mocks: $(MOCKFILES)
# mock generation:
mock_markdown/converter.go: markdown/converter.go
$(MOCKGEN) -destination=$@ $(ROOTPACKAGE)/$(<D) Converter
accessor/mock_gitea/accessor.go: accessor/gitea/accessor.go
$(MOCKGEN) -destination=$@ $(ROOTPACKAGE)/$(<D) Accessor
accessor/mock_trac/accessor.go: accessor/trac/accessor.go
$(MOCKGEN) -destination=$@ $(ROOTPACKAGE)/$(<D) Accessor
mockdeps:
GO111MODULE=on go get github.com/golang/mock/mockgen@v1.4.3
mockclean:
rm -rf mock_markdown accessor/mock_gitea accessor/mock_giteawiki accessor/mock_trac
.PHONY: lint lintdeps
lint:
@for PKG in $(PACKAGES); do golint -set_exit_status $$PKG || exit 1; done;
lintdeps:
$(GOGET) -u github.com/golang/lint/golint
.PHONY: modtidy
modtidy:
$(GOMOD) tidy