Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 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. ios:
  23. $(GORUN) build/ci.go xcode --local
  24. @echo "Done building."
  25. @echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
  26. test: all
  27. $(GORUN) build/ci.go test
  28. lint: ## Run linters.
  29. $(GORUN) build/ci.go lint
  30. clean:
  31. env GO111MODULE=on go clean -cache
  32. rm -fr build/_workspace/pkg/ $(GOBIN)/*
  33. # The devtools target installs tools required for 'go generate'.
  34. # You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
  35. devtools:
  36. env GOBIN= go get -u golang.org/x/tools/cmd/stringer
  37. env GOBIN= go get -u github.com/kevinburke/go-bindata/go-bindata
  38. env GOBIN= go get -u github.com/fjl/gencodec
  39. env GOBIN= go get -u github.com/golang/protobuf/protoc-gen-go
  40. env GOBIN= go install ./cmd/abigen
  41. @type "npm" 2> /dev/null || echo 'Please install node.js and npm'
  42. @type "solc" 2> /dev/null || echo 'Please install solc'
  43. @type "protoc" 2> /dev/null || echo 'Please install protoc'
  44. # Cross Compilation Targets (xgo)
  45. geth-cross: geth-linux geth-darwin geth-windows geth-android geth-ios
  46. @echo "Full cross compilation done:"
  47. @ls -ld $(GOBIN)/geth-*
  48. geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 geth-linux-mips64le
  49. @echo "Linux cross compilation done:"
  50. @ls -ld $(GOBIN)/geth-linux-*
  51. geth-linux-386:
  52. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth
  53. @echo "Linux 386 cross compilation done:"
  54. @ls -ld $(GOBIN)/geth-linux-* | grep 386
  55. geth-linux-amd64:
  56. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth
  57. @echo "Linux amd64 cross compilation done:"
  58. @ls -ld $(GOBIN)/geth-linux-* | grep amd64
  59. geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
  60. @echo "Linux ARM cross compilation done:"
  61. @ls -ld $(GOBIN)/geth-linux-* | grep arm
  62. geth-linux-arm-5:
  63. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth
  64. @echo "Linux ARMv5 cross compilation done:"
  65. @ls -ld $(GOBIN)/geth-linux-* | grep arm-5
  66. geth-linux-arm-6:
  67. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth
  68. @echo "Linux ARMv6 cross compilation done:"
  69. @ls -ld $(GOBIN)/geth-linux-* | grep arm-6
  70. geth-linux-arm-7:
  71. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth
  72. @echo "Linux ARMv7 cross compilation done:"
  73. @ls -ld $(GOBIN)/geth-linux-* | grep arm-7
  74. geth-linux-arm64:
  75. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth
  76. @echo "Linux ARM64 cross compilation done:"
  77. @ls -ld $(GOBIN)/geth-linux-* | grep arm64
  78. geth-linux-mips:
  79. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth
  80. @echo "Linux MIPS cross compilation done:"
  81. @ls -ld $(GOBIN)/geth-linux-* | grep mips
  82. geth-linux-mipsle:
  83. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth
  84. @echo "Linux MIPSle cross compilation done:"
  85. @ls -ld $(GOBIN)/geth-linux-* | grep mipsle
  86. geth-linux-mips64:
  87. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth
  88. @echo "Linux MIPS64 cross compilation done:"
  89. @ls -ld $(GOBIN)/geth-linux-* | grep mips64
  90. geth-linux-mips64le:
  91. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth
  92. @echo "Linux MIPS64le cross compilation done:"
  93. @ls -ld $(GOBIN)/geth-linux-* | grep mips64le
  94. geth-darwin: geth-darwin-386 geth-darwin-amd64
  95. @echo "Darwin cross compilation done:"
  96. @ls -ld $(GOBIN)/geth-darwin-*
  97. geth-darwin-386:
  98. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth
  99. @echo "Darwin 386 cross compilation done:"
  100. @ls -ld $(GOBIN)/geth-darwin-* | grep 386
  101. geth-darwin-amd64:
  102. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth
  103. @echo "Darwin amd64 cross compilation done:"
  104. @ls -ld $(GOBIN)/geth-darwin-* | grep amd64
  105. geth-windows: geth-windows-386 geth-windows-amd64
  106. @echo "Windows cross compilation done:"
  107. @ls -ld $(GOBIN)/geth-windows-*
  108. geth-windows-386:
  109. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth
  110. @echo "Windows 386 cross compilation done:"
  111. @ls -ld $(GOBIN)/geth-windows-* | grep 386
  112. geth-windows-amd64:
  113. $(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
  114. @echo "Windows amd64 cross compilation done:"
  115. @ls -ld $(GOBIN)/geth-windows-* | grep amd64