forked from bettercap/bettercap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (46 loc) · 1.31 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
TARGET=bettercap
PACKAGES=core firewall log modules network packets session tls
all: deps build
deps: godep golint gofmt gomegacheck
@dep ensure
build_with_race_detector: resources
@go build -race -o $(TARGET) .
build: resources
@go build -o $(TARGET) .
resources: network/manuf.go
network/manuf.go:
@python ./network/make_manuf.py
clean:
@rm -rf $(TARGET)
@rm -rf build
install:
@mkdir -p /usr/local/share/bettercap/caplets
@cp bettercap /usr/local/bin/
docker:
@docker build -t bettercap:latest .
# Go 1.9 doesn't support test coverage on multiple packages, while
# Go 1.10 does, let's keep it 1.9 compatible in order not to break
# travis
test: deps
@echo "mode: atomic" > coverage.profile
@for pkg in $(PACKAGES); do \
go fmt ./$$pkg ; \
go vet ./$$pkg ; \
megacheck ./$$pkg ; \
touch $$pkg.profile ; \
go test -race ./$$pkg -coverprofile=$$pkg.profile -covermode=atomic; \
tail -n +2 $$pkg.profile >> coverage.profile && rm -rf $$pkg.profile ; \
done
html_coverage: test
@go tool cover -html=coverage.profile -o coverage.profile.html
benchmark: server_deps
@go test ./... -v -run=doNotRunTests -bench=. -benchmem
# tools
godep:
@go get -u github.com/golang/dep/...
golint:
@go get -u golang.org/x/lint/golint
gomegacheck:
@go get honnef.co/go/tools/cmd/megacheck
gofmt:
gofmt -s -w $(PACKAGES)