Makefile 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. # This Makefile is meant to be used by people that do not usually work
  2. # with Go source code. If you know what GOPATH is then you probably
  3. # don't need to bother with make.
  4. .PHONY: geth android ios geth-cross evm all test truffle-test clean
  5. .PHONY: geth-linux geth-linux-386 geth-linux-amd64 geth-linux-mips64 geth-linux-mips64le
  6. .PHONY: geth-linux-arm geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
  7. .PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64
  8. .PHONY: geth-windows geth-windows-386 geth-windows-amd64
  9. GOBIN = ./build/bin
  10. GO ?= latest
  11. GORUN = env GO111MODULE=on go run
  12. geth:
  13. $(GORUN) build/ci.go install ./cmd/geth
  14. @echo "Done building."
  15. @echo "Run \"$(GOBIN)/geth\" to launch geth."
  16. all:
  17. $(GORUN) build/ci.go install
  18. android:
  19. $(GORUN) build/ci.go aar --local
  20. @echo "Done building."
  21. @echo "Import \"$(GOBIN)/geth.aar\" to use the library."
  22. @echo "Import \"$(GOBIN)/geth-sources.jar\" to add javadocs"
  23. @echo "For more info see https://stackoverflow.com/questions/20994336/android-studio-how-to-attach-javadoc"
  24. ios:
  25. $(GORUN) build/ci.go xcode --local
  26. @echo "Done building."
  27. @echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
  28. test: all
  29. $(GORUN) build/ci.go test -timeout 1h
  30. truffle-test:
  31. docker build . -f ./docker/Dockerfile --target bsc-genesis -t bsc-genesis
  32. docker build . -f ./docker/Dockerfile --target bsc -t bsc
  33. docker build . -f ./docker/Dockerfile.truffle -t truffle-test
  34. docker-compose -f ./tests/truffle/docker-compose.yml up genesis
  35. docker-compose -f ./tests/truffle/docker-compose.yml up -d bsc-rpc bsc-validator1
  36. sleep 30
  37. docker-compose -f ./tests/truffle/docker-compose.yml up --exit-code-from truffle-test truffle-test
  38. docker-compose -f ./tests/truffle/docker-compose.yml down
  39. lint: ## Run linters.
  40. $(GORUN) build/ci.go lint
  41. clean:
  42. env GO111MODULE=on go clean -cache
  43. rm -fr build/_workspace/pkg/ $(GOBIN)/*
  44. # The devtools target installs tools required for 'go generate'.
  45. # You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
  46. devtools:
  47. env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
  48. env GOBIN= go install github.com/kevinburke/go-bindata/go-bindata@latest
  49. env GOBIN= go install github.com/fjl/gencodec@latest
  50. env GOBIN= go install github.com/golang/protobuf/protoc-gen-go@latest
  51. env GOBIN= go install ./cmd/abigen
  52. @type "solc" 2> /dev/null || echo 'Please install solc'
  53. @type "protoc" 2> /dev/null || echo 'Please install protoc'
  54. # Cross Compilation Targets (xgo)
  55. geth-cross: geth-linux geth-darwin geth-windows geth-android geth-ios
  56. @echo "Full cross compilation done:"
  57. @ls -ld $(GOBIN)/geth-*
  58. geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 geth-linux-mips64le
  59. @echo "Linux cross compilation done:"
  60. @ls -ld $(GOBIN)/geth-linux-*
  61. geth-linux-386:
  62. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth
  63. @echo "Linux 386 cross compilation done:"
  64. @ls -ld $(GOBIN)/geth-linux-* | grep 386
  65. geth-linux-amd64:
  66. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth
  67. @echo "Linux amd64 cross compilation done:"
  68. @ls -ld $(GOBIN)/geth-linux-* | grep amd64
  69. geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
  70. @echo "Linux ARM cross compilation done:"
  71. @ls -ld $(GOBIN)/geth-linux-* | grep arm
  72. geth-linux-arm-5:
  73. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth
  74. @echo "Linux ARMv5 cross compilation done:"
  75. @ls -ld $(GOBIN)/geth-linux-* | grep arm-5
  76. geth-linux-arm-6:
  77. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth
  78. @echo "Linux ARMv6 cross compilation done:"
  79. @ls -ld $(GOBIN)/geth-linux-* | grep arm-6
  80. geth-linux-arm-7:
  81. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth
  82. @echo "Linux ARMv7 cross compilation done:"
  83. @ls -ld $(GOBIN)/geth-linux-* | grep arm-7
  84. geth-linux-arm64:
  85. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth
  86. @echo "Linux ARM64 cross compilation done:"
  87. @ls -ld $(GOBIN)/geth-linux-* | grep arm64
  88. geth-linux-mips:
  89. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth
  90. @echo "Linux MIPS cross compilation done:"
  91. @ls -ld $(GOBIN)/geth-linux-* | grep mips
  92. geth-linux-mipsle:
  93. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth
  94. @echo "Linux MIPSle cross compilation done:"
  95. @ls -ld $(GOBIN)/geth-linux-* | grep mipsle
  96. geth-linux-mips64:
  97. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth
  98. @echo "Linux MIPS64 cross compilation done:"
  99. @ls -ld $(GOBIN)/geth-linux-* | grep mips64
  100. geth-linux-mips64le:
  101. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth
  102. @echo "Linux MIPS64le cross compilation done:"
  103. @ls -ld $(GOBIN)/geth-linux-* | grep mips64le
  104. geth-darwin: geth-darwin-386 geth-darwin-amd64
  105. @echo "Darwin cross compilation done:"
  106. @ls -ld $(GOBIN)/geth-darwin-*
  107. geth-darwin-386:
  108. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth
  109. @echo "Darwin 386 cross compilation done:"
  110. @ls -ld $(GOBIN)/geth-darwin-* | grep 386
  111. geth-darwin-amd64:
  112. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth
  113. @echo "Darwin amd64 cross compilation done:"
  114. @ls -ld $(GOBIN)/geth-darwin-* | grep amd64
  115. geth-windows: geth-windows-386 geth-windows-amd64
  116. @echo "Windows cross compilation done:"
  117. @ls -ld $(GOBIN)/geth-windows-*
  118. geth-windows-386:
  119. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth
  120. @echo "Windows 386 cross compilation done:"
  121. @ls -ld $(GOBIN)/geth-windows-* | grep 386
  122. geth-windows-amd64:
  123. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
  124. @echo "Windows amd64 cross compilation done:"
  125. @ls -ld $(GOBIN)/geth-windows-* | grep amd64