github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/Makefile (about) 1 .DEFAULT_GOAL := build 2 3 BUILD_VERSION?=snapshot 4 SOURCE_FILES?=$$(go list ./... | grep -v /vendor/) 5 TEST_PATTERN?=. 6 TEST_OPTIONS?=-race 7 8 BINARY=bin 9 BUILD_TIME=`date +%FT%T%z` 10 COMMIT=`git log --pretty=format:'%h' -n 1` 11 12 # Choose to install geth with or without SputnikVM. 13 WITH_SVM?=1 14 15 # Provide default value of GOPATH, if it's not set in environment 16 export GOPATH?=${HOME}/go 17 18 LDFLAGS=-ldflags "-X main.Version="`git describe --tags` 19 20 setup: ## Install all the build and lint dependencies 21 go get -u github.com/alecthomas/gometalinter 22 go get -u github.com/golang/dep/... 23 go get -u github.com/pierrre/gotestcover 24 go get -u golang.org/x/tools/cmd/cover 25 go get -u github.com/omeid/go-resources/cmd/resources 26 dep ensure 27 gometalinter --install 28 29 build: cmd/abigen cmd/bootnode cmd/disasm cmd/ethtest cmd/evm cmd/gethrpctest cmd/rlpdump cmd/geth ## Build a local snapshot binary version of all commands 30 @ls -ld $(BINARY)/* 31 32 cmd/geth: chainconfig ## Build a local snapshot binary version of geth. Use WITH_SVM=0 to disable building with SputnikVM (default: WITH_SVM=1) 33 ifeq (${WITH_SVM}, 1) 34 ./scripts/build_sputnikvm.sh build 35 else 36 mkdir -p ./${BINARY} 37 go build ${LDFLAGS} -o ${BINARY}/geth -tags="netgo" ./cmd/geth 38 endif 39 @echo "Done building geth." 40 @echo "Run \"$(BINARY)/geth\" to launch geth." 41 42 cmd/abigen: ## Build a local snapshot binary version of abigen. 43 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/abigen ./cmd/abigen 44 @echo "Done building abigen." 45 @echo "Run \"$(BINARY)/abigen\" to launch abigen." 46 47 cmd/bootnode: ## Build a local snapshot of bootnode. 48 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/bootnode ./cmd/bootnode 49 @echo "Done building bootnode." 50 @echo "Run \"$(BINARY)/bootnode\" to launch bootnode." 51 52 cmd/disasm: ## Build a local snapshot of disasm. 53 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/disasm ./cmd/disasm 54 @echo "Done building disasm." 55 @echo "Run \"$(BINARY)/disasm\" to launch disasm." 56 57 cmd/ethtest: ## Build a local snapshot of ethtest. 58 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/ethtest ./cmd/ethtest 59 @echo "Done building ethtest." 60 @echo "Run \"$(BINARY)/ethtest\" to launch ethtest." 61 62 cmd/evm: ## Build a local snapshot of evm. 63 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/evm ./cmd/evm 64 @echo "Done building evm." 65 @echo "Run \"$(BINARY)/evm\" to launch evm." 66 67 cmd/gethrpctest: ## Build a local snapshot of gethrpctest. 68 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/gethrpctest ./cmd/gethrpctest 69 @echo "Done building gethrpctest." 70 @echo "Run \"$(BINARY)/gethrpctest\" to launch gethrpctest." 71 72 cmd/rlpdump: ## Build a local snapshot of rlpdump. 73 mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/rlpdump ./cmd/rlpdump 74 @echo "Done building rlpdump." 75 @echo "Run \"$(BINARY)/rlpdump\" to launch rlpdump." 76 77 install: ## Install all packages to $GOPATH/bin 78 go install ./cmd/{abigen,bootnode,disasm,ethtest,evm,gethrpctest,rlpdump} 79 $(MAKE) install_geth 80 81 install_geth: chainconfig ## Install geth to $GOPATH/bin. Use WITH_SVM=0 to disable building with SputnikVM (default: WITH_SVM=1) 82 $(info Installing $$GOPATH/bin/geth) 83 ifeq (${WITH_SVM}, 1) 84 ./scripts/build_sputnikvm.sh install 85 else 86 go install ${LDFLAGS} -tags="netgo" ./cmd/geth ; fi 87 endif 88 89 fmt: ## gofmt and goimports all go files 90 find . -name '*.go' -not -wholename './vendor/*' -not -wholename './_vendor*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done 91 92 ci: lint test ## Run all code checks and tests 93 94 lint: ## Run all the linters 95 gometalinter \ 96 --tests \ 97 --vendor \ 98 --vendored-linters \ 99 --disable=interfacer \ 100 --disable=maligned \ 101 --enable=gosimple \ 102 --enable=staticcheck \ 103 --enable=gofmt \ 104 --enable=goimports \ 105 --enable=lll \ 106 --enable=misspell \ 107 --cyclo-over=15 \ 108 --dupl-threshold=100 \ 109 --line-length=120 \ 110 --deadline=360s \ 111 ./... 112 113 test: ## Run all the tests 114 echo 'mode: atomic' > coverage.txt && \ 115 go list ./... | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp {} && \ 116 tail -n +2 coverage.tmp >> coverage.txt' && \ 117 rm coverage.tmp 118 119 cover: test ## Run all the tests and opens the coverage report 120 go tool cover -html=coverage.txt 121 122 chainconfig: core/assets/assets.go ## Rebuild assets if source config files changed. 123 124 core/assets/assets.go: ${GOPATH}/bin/resources core/config/*.json core/config/*.csv 125 ${GOPATH}/bin/resources -fmt -declare -var=DEFAULTS -package=assets -output=core/assets/assets.go core/config/*.json core/config/*.csv 126 127 ${GOPATH}/bin/resources: 128 go get -u github.com/omeid/go-resources/cmd/resources 129 130 clean: ## Remove local snapshot binary directory 131 if [ -d ${BINARY} ] ; then rm -rf ${BINARY} ; fi 132 go clean -i ./... 133 rm -rf vendor/github.com/ETCDEVTeam/sputnikvm-ffi/c/ffi/target 134 rm -f vendor/github.com/ETCDEVTeam/sputnikvm-ffi/c/libsputnikvm.* 135 136 # Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html 137 help: 138 @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 139 140 141 .PHONY: setup test cover fmt lint ci build cmd/geth cmd/abigen cmd/bootnode cmd/disasm cmd/ethtest cmd/evm cmd/gethrlptest cmd/rlpdump install install_geth clean help static