Makefile 5.4 KB

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