Makefile 5.3 KB

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