gitlab.com/jokerrs1/Sia@v1.3.2/Makefile (about) 1 # These variables get inserted into ./build/commit.go 2 BUILD_TIME=$(shell date) 3 GIT_REVISION=$(shell git rev-parse --short HEAD) 4 GIT_DIRTY=$(shell git diff-index --quiet HEAD -- || echo "✗-") 5 6 ldflags= -X github.com/NebulousLabs/Sia/build.GitRevision=${GIT_DIRTY}${GIT_REVISION} \ 7 -X "github.com/NebulousLabs/Sia/build.BuildTime=${BUILD_TIME}" 8 9 # all will build and install release binaries 10 all: release 11 12 # dependencies installs all of the dependencies that are required for building 13 # Sia. 14 dependencies: 15 # Consensus Dependencies 16 go get -u github.com/NebulousLabs/demotemutex 17 go get -u github.com/NebulousLabs/fastrand 18 go get -u github.com/NebulousLabs/merkletree 19 go get -u github.com/NebulousLabs/bolt 20 go get -u golang.org/x/crypto/blake2b 21 go get -u golang.org/x/crypto/ed25519 22 # Module + Daemon Dependencies 23 go get -u github.com/NebulousLabs/entropy-mnemonics 24 go get -u github.com/NebulousLabs/errors 25 go get -u github.com/NebulousLabs/go-upnp 26 go get -u github.com/NebulousLabs/ratelimit 27 go get -u github.com/NebulousLabs/threadgroup 28 go get -u github.com/NebulousLabs/writeaheadlog 29 go get -u github.com/klauspost/reedsolomon 30 go get -u github.com/julienschmidt/httprouter 31 go get -u github.com/inconshreveable/go-update 32 go get -u github.com/kardianos/osext 33 go get -u github.com/inconshreveable/mousetrap 34 # Frontend Dependencies 35 go get -u golang.org/x/crypto/ssh/terminal 36 go get -u github.com/spf13/cobra/... 37 # Developer Dependencies 38 go install -race std 39 go get -u github.com/client9/misspell/cmd/misspell 40 go get -u github.com/golang/lint/golint 41 go get -u github.com/NebulousLabs/glyphcheck 42 43 # pkgs changes which packages the makefile calls operate on. run changes which 44 # tests are run during testing. 45 run = . 46 pkgs = ./build ./cmd/siac ./cmd/siad ./compatibility ./crypto ./encoding ./modules ./modules/consensus ./modules/explorer \ 47 ./modules/gateway ./modules/host ./modules/host/contractmanager ./modules/renter ./modules/renter/contractor \ 48 ./modules/renter/hostdb ./modules/renter/hostdb/hosttree ./modules/renter/proto ./modules/miner ./modules/wallet \ 49 ./modules/transactionpool ./node ./node/api ./persist ./siatest ./siatest/consensus ./siatest/renter \ 50 ./node/api/server ./sync ./types 51 52 # fmt calls go fmt on all packages. 53 fmt: 54 gofmt -s -l -w $(pkgs) 55 56 # vet calls go vet on all packages. 57 # NOTE: go vet requires packages to be built in order to obtain type info. 58 vet: release-std 59 go vet $(pkgs) 60 61 # will always run on some packages for a while. 62 lintpkgs = ./build ./cmd/siac ./cmd/siad ./compatibility ./crypto ./encoding ./modules ./modules/consensus ./modules/explorer \ 63 ./modules/gateway ./modules/host ./modules/miner ./modules/host/contractmanager ./modules/renter ./modules/renter/contractor ./modules/renter/hostdb \ 64 ./modules/renter/hostdb/hosttree ./modules/renter/proto ./modules/wallet ./modules/transactionpool ./node ./node/api ./node/api/server ./persist \ 65 ./siatest ./siatest/consensus ./siatest/renter 66 lint: 67 golint -min_confidence=1.0 -set_exit_status $(lintpkgs) 68 69 # spellcheck checks for misspelled words in comments or strings. 70 spellcheck: 71 misspell -error . 72 73 # debug builds and installs debug binaries. 74 debug: 75 go install -tags='debug profile netgo' -ldflags='$(ldflags)' $(pkgs) 76 debug-race: 77 go install -race -tags='debug profile netgo' -ldflags='$(ldflags)' $(pkgs) 78 79 # dev builds and installs developer binaries. 80 dev: 81 go install -tags='dev debug profile netgo' -ldflags='$(ldflags)' $(pkgs) 82 dev-race: 83 go install -race -tags='dev debug profile netgo' -ldflags='$(ldflags)' $(pkgs) 84 85 # release builds and installs release binaries. 86 release: 87 go install -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs) 88 release-race: 89 go install -race -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs) 90 91 # clean removes all directories that get automatically created during 92 # development. 93 clean: 94 rm -rf release doc/whitepaper.aux doc/whitepaper.log doc/whitepaper.pdf 95 96 test: 97 go test -short -tags='debug testing netgo' -timeout=5s $(pkgs) -run=$(run) 98 test-v: 99 go test -race -v -short -tags='debug testing netgo' -timeout=15s $(pkgs) -run=$(run) 100 test-long: clean fmt vet lint 101 go test -v -race -tags='testing debug netgo' -timeout=500s $(pkgs) -run=$(run) 102 test-vlong: clean fmt vet lint 103 go test -v -race -tags='testing debug vlong netgo' -timeout=5000s $(pkgs) -run=$(run) 104 test-cpu: 105 go test -v -tags='testing debug netgo' -timeout=500s -cpuprofile cpu.prof $(pkgs) -run=$(run) 106 test-mem: 107 go test -v -tags='testing debug netgo' -timeout=500s -memprofile mem.prof $(pkgs) -run=$(run) 108 bench: clean fmt 109 go test -tags='debug testing netgo' -timeout=500s -run=XXX -bench=$(run) $(pkgs) 110 cover: clean 111 @mkdir -p cover/modules 112 @mkdir -p cover/modules/renter 113 @mkdir -p cover/modules/host 114 @for package in $(pkgs); do \ 115 go test -tags='testing debug' -timeout=500s -covermode=atomic -coverprofile=cover/$$package.out ./$$package -run=$(run) \ 116 && go tool cover -html=cover/$$package.out -o=cover/$$package.html \ 117 && rm cover/$$package.out ; \ 118 done 119 120 # whitepaper builds the whitepaper from whitepaper.tex. pdflatex has to be 121 # called twice because references will not update correctly the first time. 122 whitepaper: 123 @pdflatex -output-directory=doc whitepaper.tex > /dev/null 124 pdflatex -output-directory=doc whitepaper.tex 125 126 .PHONY: all dependencies fmt install release release-std xc clean test test-v test-long cover cover-integration cover-unit whitepaper 127