github.com/shrimpyuk/bor@v0.2.15-0.20220224151350-fb4ec6020bae/Makefile (about)

     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  
     5  .PHONY: geth android ios geth-cross evm all test clean
     6  .PHONY: geth-linux geth-linux-386 geth-linux-amd64 geth-linux-mips64 geth-linux-mips64le
     7  .PHONY: geth-linux-arm geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
     8  .PHONY: geth-darwin geth-darwin-386 geth-darwin-amd64
     9  .PHONY: geth-windows geth-windows-386 geth-windows-amd64
    10  
    11  GOBIN = ./build/bin
    12  GO ?= latest
    13  GORUN = env GO111MODULE=on go run
    14  GOPATH = $(shell go env GOPATH)
    15  
    16  bor:
    17  	$(GORUN) build/ci.go install ./cmd/geth
    18  	mkdir -p $(GOPATH)/bin/
    19  	cp $(GOBIN)/geth $(GOBIN)/bor
    20  	cp $(GOBIN)/* $(GOPATH)/bin/
    21  
    22  bor-all:
    23  	$(GORUN) build/ci.go install
    24  	mkdir -p $(GOPATH)/bin/
    25  	cp $(GOBIN)/geth $(GOBIN)/bor
    26  	cp $(GOBIN)/* $(GOPATH)/bin/
    27  
    28  protoc:
    29  	protoc --go_out=. --go-grpc_out=. ./command/server/proto/*.proto
    30  
    31  geth:
    32  	$(GORUN) build/ci.go install ./cmd/geth
    33  	@echo "Done building."
    34  	@echo "Run \"$(GOBIN)/geth\" to launch geth."
    35  
    36  all:
    37  	$(GORUN) build/ci.go install
    38  
    39  android:
    40  	$(GORUN) build/ci.go aar --local
    41  	@echo "Done building."
    42  	@echo "Import \"$(GOBIN)/geth.aar\" to use the library."
    43  	@echo "Import \"$(GOBIN)/geth-sources.jar\" to add javadocs"
    44  	@echo "For more info see https://stackoverflow.com/questions/20994336/android-studio-how-to-attach-javadoc"
    45  
    46  ios:
    47  	$(GORUN) build/ci.go xcode --local
    48  	@echo "Done building."
    49  	@echo "Import \"$(GOBIN)/Geth.framework\" to use the library."
    50  
    51  test:
    52  	# Skip mobile and cmd tests since they are being deprecated
    53  	go test -v $$(go list ./... | grep -v go-ethereum/cmd/)
    54  
    55  lint: ## Run linters.
    56  	$(GORUN) build/ci.go lint
    57  
    58  clean:
    59  	env GO111MODULE=on go clean -cache
    60  	rm -fr build/_workspace/pkg/ $(GOBIN)/*
    61  
    62  # The devtools target installs tools required for 'go generate'.
    63  # You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
    64  
    65  devtools:
    66  	env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
    67  	env GOBIN= go install github.com/kevinburke/go-bindata/go-bindata@latest
    68  	env GOBIN= go install github.com/fjl/gencodec@latest
    69  	env GOBIN= go install github.com/golang/protobuf/protoc-gen-go@latest
    70  	env GOBIN= go install ./cmd/abigen
    71  	@type "solc" 2> /dev/null || echo 'Please install solc'
    72  	@type "protoc" 2> /dev/null || echo 'Please install protoc'
    73  
    74  # Cross Compilation Targets (xgo)
    75  
    76  geth-cross: geth-linux geth-darwin geth-windows geth-android geth-ios
    77  	@echo "Full cross compilation done:"
    78  	@ls -ld $(GOBIN)/geth-*
    79  
    80  geth-linux: geth-linux-386 geth-linux-amd64 geth-linux-arm geth-linux-mips64 geth-linux-mips64le
    81  	@echo "Linux cross compilation done:"
    82  	@ls -ld $(GOBIN)/geth-linux-*
    83  
    84  geth-linux-386:
    85  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/386 -v ./cmd/geth
    86  	@echo "Linux 386 cross compilation done:"
    87  	@ls -ld $(GOBIN)/geth-linux-* | grep 386
    88  
    89  geth-linux-amd64:
    90  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/amd64 -v ./cmd/geth
    91  	@echo "Linux amd64 cross compilation done:"
    92  	@ls -ld $(GOBIN)/geth-linux-* | grep amd64
    93  
    94  geth-linux-arm: geth-linux-arm-5 geth-linux-arm-6 geth-linux-arm-7 geth-linux-arm64
    95  	@echo "Linux ARM cross compilation done:"
    96  	@ls -ld $(GOBIN)/geth-linux-* | grep arm
    97  
    98  geth-linux-arm-5:
    99  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-5 -v ./cmd/geth
   100  	@echo "Linux ARMv5 cross compilation done:"
   101  	@ls -ld $(GOBIN)/geth-linux-* | grep arm-5
   102  
   103  geth-linux-arm-6:
   104  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-6 -v ./cmd/geth
   105  	@echo "Linux ARMv6 cross compilation done:"
   106  	@ls -ld $(GOBIN)/geth-linux-* | grep arm-6
   107  
   108  geth-linux-arm-7:
   109  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm-7 -v ./cmd/geth
   110  	@echo "Linux ARMv7 cross compilation done:"
   111  	@ls -ld $(GOBIN)/geth-linux-* | grep arm-7
   112  
   113  geth-linux-arm64:
   114  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/arm64 -v ./cmd/geth
   115  	@echo "Linux ARM64 cross compilation done:"
   116  	@ls -ld $(GOBIN)/geth-linux-* | grep arm64
   117  
   118  geth-linux-mips:
   119  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips --ldflags '-extldflags "-static"' -v ./cmd/geth
   120  	@echo "Linux MIPS cross compilation done:"
   121  	@ls -ld $(GOBIN)/geth-linux-* | grep mips
   122  
   123  geth-linux-mipsle:
   124  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mipsle --ldflags '-extldflags "-static"' -v ./cmd/geth
   125  	@echo "Linux MIPSle cross compilation done:"
   126  	@ls -ld $(GOBIN)/geth-linux-* | grep mipsle
   127  
   128  geth-linux-mips64:
   129  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64 --ldflags '-extldflags "-static"' -v ./cmd/geth
   130  	@echo "Linux MIPS64 cross compilation done:"
   131  	@ls -ld $(GOBIN)/geth-linux-* | grep mips64
   132  
   133  geth-linux-mips64le:
   134  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=linux/mips64le --ldflags '-extldflags "-static"' -v ./cmd/geth
   135  	@echo "Linux MIPS64le cross compilation done:"
   136  	@ls -ld $(GOBIN)/geth-linux-* | grep mips64le
   137  
   138  geth-darwin: geth-darwin-386 geth-darwin-amd64
   139  	@echo "Darwin cross compilation done:"
   140  	@ls -ld $(GOBIN)/geth-darwin-*
   141  
   142  geth-darwin-386:
   143  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/386 -v ./cmd/geth
   144  	@echo "Darwin 386 cross compilation done:"
   145  	@ls -ld $(GOBIN)/geth-darwin-* | grep 386
   146  
   147  geth-darwin-amd64:
   148  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=darwin/amd64 -v ./cmd/geth
   149  	@echo "Darwin amd64 cross compilation done:"
   150  	@ls -ld $(GOBIN)/geth-darwin-* | grep amd64
   151  
   152  geth-windows: geth-windows-386 geth-windows-amd64
   153  	@echo "Windows cross compilation done:"
   154  	@ls -ld $(GOBIN)/geth-windows-*
   155  
   156  geth-windows-386:
   157  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/386 -v ./cmd/geth
   158  	@echo "Windows 386 cross compilation done:"
   159  	@ls -ld $(GOBIN)/geth-windows-* | grep 386
   160  
   161  geth-windows-amd64:
   162  	$(GORUN) build/ci.go xgo -- --go=$(GO) --targets=windows/amd64 -v ./cmd/geth
   163  	@echo "Windows amd64 cross compilation done:"
   164  	@ls -ld $(GOBIN)/geth-windows-* | grep amd64
   165  
   166  PACKAGE_NAME          := github.com/maticnetwork/bor
   167  GOLANG_CROSS_VERSION  ?= v1.17.2
   168  
   169  .PHONY: release-dry-run
   170  release-dry-run:
   171  	@docker run \
   172  		--rm \
   173  		--privileged \
   174  		-e CGO_ENABLED=1 \
   175  		-e GITHUB_TOKEN \
   176  		-e DOCKER_USERNAME \
   177  		-e DOCKER_PASSWORD \
   178  		-v /var/run/docker.sock:/var/run/docker.sock \
   179  		-v `pwd`:/go/src/$(PACKAGE_NAME) \
   180  		-w /go/src/$(PACKAGE_NAME) \
   181  		ghcr.io/troian/golang-cross:${GOLANG_CROSS_VERSION} \
   182  		--rm-dist --skip-validate --skip-publish
   183  
   184  .PHONY: release
   185  release:
   186  	@docker run \
   187  		--rm \
   188  		--privileged \
   189  		-e CGO_ENABLED=1 \
   190  		-e GITHUB_TOKEN \
   191  		-e DOCKER_USERNAME \
   192  		-e DOCKER_PASSWORD \
   193  		-e SLACK_WEBHOOK \
   194  		-v /var/run/docker.sock:/var/run/docker.sock \
   195  		-v `pwd`:/go/src/$(PACKAGE_NAME) \
   196  		-w /go/src/$(PACKAGE_NAME) \
   197  		ghcr.io/troian/golang-cross:${GOLANG_CROSS_VERSION} \
   198  		--rm-dist --skip-validate