This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
forked from andersjohnsen/can-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (58 loc) · 1.91 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
SHELL := /bin/bash
all: \
commitlint \
stringer-generate \
mockgen-generate \
testdata \
go-lint \
go-review \
go-test \
go-mod-tidy \
git-verify-nodiff
include tools/commitlint/rules.mk
include tools/git-verify-nodiff/rules.mk
include tools/golangci-lint/rules.mk
include tools/goreview/rules.mk
include tools/semantic-release/rules.mk
include tools/stringer/rules.mk
.PHONY: clean
clean:
$(info [$@] removing build files...)
@rm -rf tools/*/*/ build
.PHONY: mockgen-generate
mockgen-generate: \
internal/gen/mock/mockcanrunner/mocks.go \
internal/gen/mock/mockclock/mocks.go \
internal/gen/mock/mocksocketcan/mocks.go
internal/gen/mock/mockcanrunner/mocks.go: pkg/canrunner/run.go go.mod
go run github.com/golang/mock/mockgen \
-destination $@ -package mockcanrunner github.com/toitware/can-go/pkg/canrunner \
Node,TransmittedMessage,ReceivedMessage,FrameTransmitter,FrameReceiver
internal/gen/mock/mockclock/mocks.go: internal/clock/clock.go go.mod
go run github.com/golang/mock/mockgen \
-destination $@ -package mockclock github.com/toitware/can-go/internal/clock \
Clock,Ticker
internal/gen/mock/mocksocketcan/mocks.go: pkg/socketcan/fileconn.go go.mod
go run github.com/golang/mock/mockgen \
-destination $@ -package mocksocketcan -source $<
.PHONY: stringer-generate
stringer-generate: \
pkg/descriptor/sendtype_string.go \
pkg/socketcan/errorclass_string.go \
pkg/socketcan/protocolviolationerrorlocation_string.go \
pkg/socketcan/protocolviolationerror_string.go \
pkg/socketcan/controllererror_string.go \
pkg/socketcan/transceivererror_string.go
%_string.go: %.go $(stringer)
go generate $<
.PHONY: testdata
testdata:
go run cmd/cantool/main.go generate testdata/dbc testdata/gen/go
.PHONY: go-test
go-test:
$(info [$@] running Go tests...)
@mkdir -p build/coverage
@go test -short -race -coverprofile=build/coverage/$@.txt -covermode=atomic ./...
.PHONY: go-mod-tidy
go-mod-tidy:
go mod tidy -v