This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
forked from HyperspaceApp/Hyperspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
138 lines (121 loc) · 5.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# These variables get inserted into ./build/commit.go
BUILD_TIME=$(shell date)
GIT_REVISION=$(shell git rev-parse --short HEAD)
GIT_DIRTY=$(shell git diff-index --quiet HEAD -- || echo "✗-")
ldflags= -X github.com/HyperspaceApp/Hyperspace/build.GitRevision=${GIT_DIRTY}${GIT_REVISION} \
-X "github.com/HyperspaceApp/Hyperspace/build.BuildTime=${BUILD_TIME}"
# all will build and install release binaries
all: release
# dependencies installs all of the dependencies that are required for building
# Sia.
dependencies:
# Consensus Dependencies
go get -u gitlab.com/NebulousLabs/demotemutex
go get -u gitlab.com/NebulousLabs/fastrand
go get -u gitlab.com/NebulousLabs/merkletree
go get -u gitlab.com/NebulousLabs/bolt
go get -u gitlab.com/NebulousLabs/Sia/sync
go get -u golang.org/x/crypto/blake2b
go get -u golang.org/x/crypto/ed25519
# Module + Daemon Dependencies
go get -u gitlab.com/NebulousLabs/entropy-mnemonics
go get -u gitlab.com/NebulousLabs/errors
go get -u gitlab.com/NebulousLabs/go-upnp
go get -u gitlab.com/NebulousLabs/ratelimit
go get -u gitlab.com/NebulousLabs/threadgroup
go get -u gitlab.com/NebulousLabs/writeaheadlog
go get -u github.com/klauspost/reedsolomon
go get -u github.com/julienschmidt/httprouter
go get -u github.com/inconshreveable/go-update
go get -u github.com/kardianos/osext
go get -u github.com/inconshreveable/mousetrap
go get -u github.com/go-sql-driver/mysql
go get -u github.com/lib/pq
go get github.com/sasha-s/go-deadlock/...
go get -u github.com/gorilla/websocket
# Frontend Dependencies
go get -u golang.org/x/crypto/ssh/terminal
go get -u github.com/spf13/cobra/...
go get -u github.com/spf13/viper
go get -u github.com/inconshreveable/mousetrap
# Developer Dependencies
#go install -race std
go get -u github.com/client9/misspell/cmd/misspell
go get -u github.com/golang/lint/golint
go get -u gitlab.com/NebulousLabs/glyphcheck
# pkgs changes which packages the makefile calls operate on. run changes which
# tests are run during testing.
run = .
pkgs = ./build ./cmd/hsc ./cmd/hsd ./compatibility ./crypto ./encoding ./modules ./modules/consensus ./modules/explorer \
./modules/gateway ./modules/host ./modules/host/contractmanager ./modules/renter ./modules/renter/contractor \
./modules/renter/hostdb ./modules/renter/hostdb/hosttree ./modules/renter/proto ./modules/miner ./modules/miningpool \
./modules/wallet ./modules/transactionpool ./modules/stratumminer ./node ./node/api ./persist ./siatest \
./siatest/consensus ./siatest/renter ./siatest/wallet ./node/api/server ./sync ./types
# fmt calls go fmt on all packages.
fmt:
gofmt -s -l -w $(pkgs)
# vet calls go vet on all packages.
# NOTE: go vet requires packages to be built in order to obtain type info.
vet: release-std
go vet $(pkgs)
lint:
golint -min_confidence=1.0 -set_exit_status $(pkgs)
# spellcheck checks for misspelled words in comments or strings.
spellcheck:
misspell -error .
# debug builds and installs debug binaries.
debug:
go install -tags='debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
debug-race:
go install -race -tags='debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
# dev builds and installs developer binaries.
dev:
go install -tags='dev debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
dev-race:
go install -race -tags='dev debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
# release builds and installs release binaries.
release:
go install -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs)
release-race:
go install -race -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs)
# deploy builds release binaries for every platform.
deploy:
./deploy.sh
# clean removes all directories that get automatically created during
# development.
clean:
#rm -rf cover doc/whitepaper.aux doc/whitepaper.log doc/whitepaper.pdf release
rm -rf cover release
test:
go test -short -tags='debug testing netgo' -timeout=5s $(pkgs) -run=$(run)
test-v:
go test -race -v -short -tags='debug testing netgo' -timeout=15s $(pkgs) -run=$(run)
test-long: clean fmt vet lint
@mkdir -p cover
go test --coverprofile='./cover/cover.out' -v -race -tags='testing debug netgo' -timeout=1200s $(pkgs) -run=$(run)
test-vlong: clean fmt vet lint
@mkdir -p cover
go test --coverprofile='./cover/cover.out' -v -race -tags='testing debug vlong netgo' -timeout=5000s $(pkgs) -run=$(run)
test-cpu:
go test -v -tags='testing debug netgo' -timeout=500s -cpuprofile cpu.prof $(pkgs) -run=$(run)
test-mem:
go test -v -tags='testing debug netgo' -timeout=500s -memprofile mem.prof $(pkgs) -run=$(run)
test-pool:
go test -short -parallel=1 -tags='testing debug pool' -timeout=120s ./modules/miningpool -run=$(run)
bench: clean fmt
go test -tags='debug testing netgo' -timeout=500s -run=XXX -bench=$(run) $(pkgs)
cover: clean
@mkdir -p cover
@for package in $(pkgs); do \
mkdir -p `dirname cover/$$package` \
&& go test -tags='testing debug netgo' -timeout=500s -covermode=atomic -coverprofile=cover/$$package.out ./$$package -run=$(run) \
&& go tool cover -html=cover/$$package.out -o=cover/$$package.html \
&& rm cover/$$package.out ; \
done
# whitepaper builds the whitepaper from whitepaper.tex. pdflatex has to be
# called twice because references will not update correctly the first time.
#whitepaper:
# @pdflatex -output-directory=doc whitepaper.tex > /dev/null
# pdflatex -output-directory=doc whitepaper.tex
#.PHONY: all dependencies fmt install release release-std xc clean test test-v test-long cover cover-integration cover-unit whitepaper
.PHONY: all dependencies fmt install release release-std xc clean test test-v test-long cover cover-integration cover-unit