Makefile 4.05 KB
Newer Older
1 2
# all will build and install developer binaries, which have debugging enabled
# and much faster mining and block constants.
3 4
all: install

David Vorick's avatar
David Vorick committed
5 6 7
# dependencies installs all of the dependencies that are required for building
# Sia.
dependencies:
David Vorick's avatar
David Vorick committed
8
	# Consensus Dependencies
9
	go get -u github.com/NebulousLabs/demotemutex
Luke Champine's avatar
Luke Champine committed
10
	go get -u github.com/NebulousLabs/fastrand
David Vorick's avatar
David Vorick committed
11
	go get -u github.com/NebulousLabs/merkletree
12
	go get -u github.com/NebulousLabs/bolt
13
	go get -u golang.org/x/crypto/blake2b
14
	go get -u golang.org/x/crypto/ed25519
David Vorick's avatar
David Vorick committed
15 16
	# Module + Daemon Dependencies
	go get -u github.com/NebulousLabs/entropy-mnemonics
17
	go get -u github.com/NebulousLabs/go-upnp
Jordan Horwich's avatar
Jordan Horwich committed
18
	go get -u github.com/NebulousLabs/muxado
19
	go get -u github.com/klauspost/reedsolomon
Luke Champine's avatar
Luke Champine committed
20
	go get -u github.com/julienschmidt/httprouter
21 22
	go get -u github.com/inconshreveable/go-update
	go get -u github.com/kardianos/osext
David Vorick's avatar
David Vorick committed
23 24
	# Frontend Dependencies
	go get -u github.com/bgentry/speakeasy
Bjorn Dolk's avatar
Bjorn Dolk committed
25
	go get -u github.com/spf13/cobra/...
David Vorick's avatar
David Vorick committed
26 27
	# Developer Dependencies
	go install -race std
28
	go get -u github.com/golang/lint/golint
Luke Champine's avatar
Luke Champine committed
29
	go get -u github.com/NebulousLabs/glyphcheck
David Vorick's avatar
David Vorick committed
30

31 32
# pkgs changes which packages the makefile calls operate on. run changes which
# tests are run during testing.
33
run = .
34
pkgs = ./api ./build ./compatibility ./crypto ./encoding ./modules ./modules/consensus                                  \
David Vorick's avatar
David Vorick committed
35
       ./modules/explorer ./modules/gateway ./modules/host ./modules/host/contractmanager                               \
36 37 38
       ./modules/renter ./modules/renter/contractor ./modules/renter/hostdb ./modules/renter/hostdb/hosttree            \
       ./modules/renter/proto ./modules/miner ./modules/wallet ./modules/transactionpool ./persist ./siac               \
       ./siad ./sync ./types
39

40
# fmt calls go fmt on all packages.
41
fmt:
Luke Champine's avatar
Luke Champine committed
42
	gofmt -s -l -w $(pkgs)
43

44
# vet calls go vet on all packages.
45 46
# NOTE: go vet requires packages to be built in order to obtain type info.
vet: release-std
47 48
	go vet $(pkgs)

49
# will always run on some packages for a while.
David Vorick's avatar
David Vorick committed
50
lintpkgs = ./modules ./modules/gateway ./modules/host ./modules/renter/hostdb ./modules/renter/contractor ./persist
51
lint:
52 53 54 55
	@for package in $(lintpkgs); do                           \
		golint -min_confidence=1.0 $$package                  \
		&& test -z $$(golint -min_confidence=1.0 $$package) ; \
	done
56

57
# install builds and installs developer binaries.
58
install:
59
	go install -race -tags='dev debug profile' $(pkgs)
60

David Vorick's avatar
David Vorick committed
61
# release builds and installs release binaries.
62
release:
63 64
	go install -tags='debug profile' $(pkgs)
release-race:
David Vorick's avatar
David Vorick committed
65
	go install -race -tags='debug profile' $(pkgs)
66
release-std:
David Vorick's avatar
David Vorick committed
67
	go install $(pkgs)
David Vorick's avatar
David Vorick committed
68

69 70
# clean removes all directories that get automatically created during
# development.
71
clean:
72
	rm -rf release doc/whitepaper.aux doc/whitepaper.log doc/whitepaper.pdf
73

74
test:
Luke Champine's avatar
Luke Champine committed
75
	go test -short -tags='debug testing' -timeout=5s $(pkgs) -run=$(run)
76
test-v:
David Vorick's avatar
David Vorick committed
77
	go test -race -v -short -tags='debug testing' -timeout=15s $(pkgs) -run=$(run)
78
test-long: clean fmt vet lint
79
	go test -v -race -tags='testing debug' -timeout=500s $(pkgs) -run=$(run)
80
bench: clean fmt
81
	go test -tags='debug testing' -timeout=500s -run=XXX -bench=$(run) $(pkgs)
82
cover: clean
83
	@mkdir -p cover/modules
84
	@mkdir -p cover/modules/renter
85
	@mkdir -p cover/modules/host
86 87 88 89
	@for package in $(pkgs); do                                                                                                 \
		go test -tags='testing debug' -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 ;                                                                                             \
90
	done
91

92 93
# whitepaper builds the whitepaper from whitepaper.tex. pdflatex has to be
# called twice because references will not update correctly the first time.
94
whitepaper:
95 96
	@pdflatex -output-directory=doc whitepaper.tex > /dev/null
	pdflatex -output-directory=doc whitepaper.tex
97

98
.PHONY: all dependencies fmt install release release-std xc clean test test-v test-long cover cover-integration cover-unit whitepaper