github.com/NebulousLabs/Sia@v1.3.7/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         ./siatest/wallet ./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  lint:
    62  	golint -min_confidence=1.0 -set_exit_status $(pkgs)
    63  
    64  # spellcheck checks for misspelled words in comments or strings.
    65  spellcheck:
    66  	misspell -error .
    67  
    68  # debug builds and installs debug binaries.
    69  debug:
    70  	go install -tags='debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
    71  debug-race:
    72  	go install -race -tags='debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
    73  
    74  # dev builds and installs developer binaries.
    75  dev:
    76  	go install -tags='dev debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
    77  dev-race:
    78  	go install -race -tags='dev debug profile netgo' -ldflags='$(ldflags)' $(pkgs)
    79  
    80  # release builds and installs release binaries.
    81  release:
    82  	go install -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs)
    83  release-race:
    84  	go install -race -tags='netgo' -a -ldflags='-s -w $(ldflags)' $(pkgs)
    85  
    86  # clean removes all directories that get automatically created during
    87  # development.
    88  clean:
    89  	rm -rf cover doc/whitepaper.aux doc/whitepaper.log doc/whitepaper.pdf release 
    90  
    91  test:
    92  	go test -short -tags='debug testing netgo' -timeout=5s $(pkgs) -run=$(run)
    93  test-v:
    94  	go test -race -v -short -tags='debug testing netgo' -timeout=15s $(pkgs) -run=$(run)
    95  test-long: clean fmt vet lint
    96  	go test -v -race -tags='testing debug netgo' -timeout=500s $(pkgs) -run=$(run)
    97  test-vlong: clean fmt vet lint
    98  	go test -v -race -tags='testing debug vlong netgo' -timeout=5000s $(pkgs) -run=$(run)
    99  test-cpu:
   100  	go test -v -tags='testing debug netgo' -timeout=500s -cpuprofile cpu.prof $(pkgs) -run=$(run)
   101  test-mem:
   102  	go test -v -tags='testing debug netgo' -timeout=500s -memprofile mem.prof $(pkgs) -run=$(run)
   103  bench: clean fmt
   104  	go test -tags='debug testing netgo' -timeout=500s -run=XXX -bench=$(run) $(pkgs)
   105  cover: clean
   106  	@mkdir -p cover
   107  	@for package in $(pkgs); do                                                                                                          \
   108  		mkdir -p `dirname cover/$$package`                                                                                        \
   109  		&& go test -tags='testing debug netgo' -timeout=500s -covermode=atomic -coverprofile=cover/$$package.out ./$$package -run=$(run) \
   110  		&& go tool cover -html=cover/$$package.out -o=cover/$$package.html                                                               \
   111  		&& rm cover/$$package.out ;                                                                                                      \
   112  	done
   113  
   114  # whitepaper builds the whitepaper from whitepaper.tex. pdflatex has to be
   115  # called twice because references will not update correctly the first time.
   116  whitepaper:
   117  	@pdflatex -output-directory=doc whitepaper.tex > /dev/null
   118  	pdflatex -output-directory=doc whitepaper.tex
   119  
   120  .PHONY: all dependencies fmt install release release-std xc clean test test-v test-long cover cover-integration cover-unit whitepaper
   121