github.com/avahowell/sia@v0.5.1-beta.0.20160524050156-83dcc3d37c94/Makefile (about)

     1  # all will build and install developer binaries, which have debugging enabled
     2  # and much faster mining and block constants.
     3  all: install
     4  
     5  # dependencies installs all of the dependencies that are required for building
     6  # Sia.
     7  dependencies:
     8  	# Consensus Dependencies
     9  	go get -u github.com/NebulousLabs/demotemutex
    10  	go get -u github.com/NebulousLabs/ed25519
    11  	go get -u github.com/NebulousLabs/merkletree
    12  	go get -u github.com/NebulousLabs/bolt
    13  	go get -u github.com/dchest/blake2b
    14  	# Module + Daemon Dependencies
    15  	go get -u github.com/NebulousLabs/entropy-mnemonics
    16  	go get -u github.com/NebulousLabs/go-upnp
    17  	go get -u github.com/NebulousLabs/muxado
    18  	go get -u github.com/klauspost/reedsolomon
    19  	go get -u github.com/julienschmidt/httprouter
    20  	# Frontend Dependencies
    21  	go get -u github.com/bgentry/speakeasy
    22  	go get -u github.com/spf13/cobra
    23  	# Developer Dependencies
    24  	go install -race std
    25  	go get -u github.com/golang/lint/golint
    26  	go get -u github.com/laher/goxc
    27  
    28  # pkgs changes which packages the makefile calls operate on. run changes which
    29  # tests are run during testing.
    30  run = Test
    31  pkgs = ./api ./build ./compatibility ./crypto ./encoding ./modules ./modules/consensus \
    32         ./modules/explorer ./modules/gateway ./modules/host ./modules/host/storagemanager \
    33  	   ./modules/renter/hostdb ./modules/renter/contractor ./modules/miner ./modules/renter \
    34  	   ./modules/wallet ./modules/transactionpool ./persist ./siac ./siad ./sync ./types
    35  
    36  # fmt calls go fmt on all packages.
    37  fmt:
    38  	gofmt -s -l -w $(pkgs)
    39  
    40  # vet calls go vet on all packages.
    41  # NOTE: go vet requires packages to be built in order to obtain type info.
    42  vet: release-std
    43  	go vet $(pkgs)
    44  
    45  # will always run on some packages for a while.
    46  lintpkgs = ./modules/host ./modules ./modules/renter/hostdb ./modules/renter/contractor ./persist
    47  lint:
    48  	@for package in $(lintpkgs); do                           \
    49  		golint -min_confidence=1.0 $$package                  \
    50  		&& test -z $$(golint -min_confidence=1.0 $$package) ; \
    51  	done
    52  
    53  # install builds and installs developer binaries.
    54  install:
    55  	go install -race -tags='dev debug profile' $(pkgs)
    56  
    57  # release builds and installs release binaries.
    58  release:
    59  	go install -tags='debug profile' $(pkgs)
    60  release-race:
    61  	go install -race -tags='debug profile' $(pkgs)
    62  release-std:
    63  	go install $(pkgs)
    64  
    65  # xc builds and packages release binaries for all systems by using goxc.
    66  # Cross Compile - makes binaries for windows, linux, and mac, 32 and 64 bit.
    67  xc: dependencies test test-long
    68  	goxc -arch="386 amd64 arm" -bc="darwin linux windows" -d=release \
    69  	     -pv=v0.6.0 -br=beta -include=LICENSE,README.md,doc/API.md   \
    70  	     -tasks-=archive,rmbin,deb,deb-dev,deb-source,go-test -n=Sia
    71  
    72  # clean removes all directories that get automatically created during
    73  # development.
    74  clean:
    75  	rm -rf release doc/whitepaper.aux doc/whitepaper.log doc/whitepaper.pdf
    76  
    77  test:
    78  	go test -short -tags='debug testing' -timeout=5s $(pkgs) -run=$(run)
    79  test-v:
    80  	go test -race -v -short -tags='debug testing' -timeout=15s $(pkgs) -run=$(run)
    81  test-long: clean fmt vet lint
    82  	go test -v -race -tags='testing debug' -timeout=300s $(pkgs) -run=$(run)
    83  bench: clean fmt
    84  	go test -tags='testing' -timeout=300s -run=XXX -bench=. $(pkgs)
    85  cover: clean
    86  	@mkdir -p cover/modules
    87  	@mkdir -p cover/modules/renter
    88  	@for package in $(pkgs); do                                                                                     \
    89  		go test -tags='testing debug' -timeout=360s -covermode=atomic -coverprofile=cover/$$package.out ./$$package \
    90  		&& go tool cover -html=cover/$$package.out -o=cover/$$package.html                                          \
    91  		&& rm cover/$$package.out ;                                                                                 \
    92  	done
    93  cover-integration: clean
    94  	@mkdir -p cover/modules
    95  	@mkdir -p cover/modules/renter
    96  	@for package in $(pkgs); do                                                                                     \
    97  		go test -run=TestIntegration -tags='testing debug' -timeout=360s -covermode=atomic -coverprofile=cover/$$package.out ./$$package \
    98  		&& go tool cover -html=cover/$$package.out -o=cover/$$package.html                                          \
    99  		&& rm cover/$$package.out ;                                                                                 \
   100  	done
   101  cover-unit: clean
   102  	@mkdir -p cover/modules
   103  	@mkdir -p cover/modules/renter
   104  	@for package in $(pkgs); do                                                                                     \
   105  		go test -run=TestUnit -tags='testing debug' -timeout=360s -covermode=atomic -coverprofile=cover/$$package.out ./$$package \
   106  		&& go tool cover -html=cover/$$package.out -o=cover/$$package.html                                          \
   107  		&& rm cover/$$package.out ;                                                                                 \
   108  	done
   109  
   110  # whitepaper builds the whitepaper from whitepaper.tex. pdflatex has to be
   111  # called twice because references will not update correctly the first time.
   112  whitepaper:
   113  	@pdflatex -output-directory=doc whitepaper.tex > /dev/null
   114  	pdflatex -output-directory=doc whitepaper.tex
   115  
   116  .PHONY: all dependencies fmt install release release-std xc clean test test-v test-long cover cover-integration cover-unit whitepaper