github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/Makefile (about)

     1  include version.mk
     2  
     3  ARCH := $(shell arch)
     4  
     5  ifeq ($(ARCH),x86_64)
     6  	ARCH = amd64
     7  else 
     8  	ifeq ($(ARCH),aarch64)
     9  		ARCH = arm64
    10  	endif
    11  endif
    12  GOBASE := $(shell pwd)
    13  GOBIN := $(GOBASE)/dist
    14  GOENVVARS := GOBIN=$(GOBIN) CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH)
    15  GOBINARY := supernets2-node
    16  GOCMD := $(GOBASE)/cmd
    17  
    18  LDFLAGS += -X 'github.com/0xPolygon/supernets2-node.Version=$(VERSION)'
    19  LDFLAGS += -X 'github.com/0xPolygon/supernets2-node.GitRev=$(GITREV)'
    20  LDFLAGS += -X 'github.com/0xPolygon/supernets2-node.GitBranch=$(GITBRANCH)'
    21  LDFLAGS += -X 'github.com/0xPolygon/supernets2-node.BuildDate=$(DATE)'
    22  
    23  .PHONY: build
    24  build: ## Builds the binary locally into ./dist
    25  	$(GOENVVARS) go build -ldflags "all=$(LDFLAGS)" -o $(GOBIN)/$(GOBINARY) $(GOCMD)
    26  
    27  .PHONY: build-docker
    28  build-docker: ## Builds a docker image with the node binary
    29  	docker build -t supernets2-node -f ./Dockerfile .
    30  
    31  .PHONY: build-docker-nc
    32  build-docker-nc: ## Builds a docker image with the node binary - but without build cache
    33  	docker build --no-cache=true -t supernets2-node -f ./Dockerfile .
    34  
    35  .PHONY: run-rpc
    36  run-rpc: ## Runs all the services need to run a local zkEMV RPC node
    37  	docker-compose up -d supernets2-state-db supernets2-pool-db
    38  	sleep 2
    39  	docker-compose up -d supernets2-prover
    40  	sleep 5
    41  	docker-compose up -d supernets2-sync
    42  	sleep 2
    43  	docker-compose up -d supernets2-rpc
    44  
    45  .PHONY: stop
    46  stop: ## Stops all services
    47  	docker-compose down
    48  
    49  .PHONY: install-linter
    50  install-linter: ## Installs the linter
    51  	curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$(go env GOPATH)/bin v1.52.2
    52  
    53  .PHONY: lint
    54  lint: ## Runs the linter
    55  	export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/golangci-lint run
    56  
    57  .PHONY: update-external-dependencies
    58  update-external-dependencies: ## Updates external dependencies like images, test vectors or proto files
    59  	go run ./scripts/cmd/... updatedeps
    60  
    61  .PHONY: install-git-hooks
    62  install-git-hooks: ## Moves hook files to the .git/hooks directory
    63  	cp .github/hooks/* .git/hooks
    64  
    65  .PHONY: generate-code-from-proto
    66  generate-code-from-proto: ## Generates code from proto files
    67  	cd proto/src/proto/statedb/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../merkletree/pb --go-grpc_out=../../../../../merkletree/pb --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative statedb.proto
    68  	cd proto/src/proto/executor/v1 && protoc --proto_path=. --go_out=../../../../../state/runtime/executor/pb --go-grpc_out=../../../../../state/runtime/executor/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative executor.proto
    69  	cd proto/src/proto/aggregator/v1 && protoc --proto_path=. --proto_path=../../../../include --go_out=../../../../../aggregator/pb --go-grpc_out=../../../../../aggregator/pb --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative aggregator.proto
    70  
    71  ## Help display.
    72  ## Pulls comments from beside commands and prints a nicely formatted
    73  ## display with the commands and their usage information.
    74  .DEFAULT_GOAL := help
    75  
    76  .PHONY: help
    77  help: ## Prints this help
    78  		@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
    79  		| sort \
    80  		| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'