github.com/aquanetwork/aquachain@v1.7.8/Makefile (about)

     1  GOBIN = $(shell pwd)/build/bin
     2  GO ?= latest
     3  PREFIX ?= ${HOME}/.local/bin/
     4  
     5  # make build environment script executable (gets unset through ipfs)
     6  DOFIRST=$(shell chmod +x build/env.sh)
     7  
     8  # default build
     9  aquachain-nocgo:
    10  	@echo "Building aquachain with no tracer/usb support."
    11  	@echo "Consider \"${MAKE} usb\" or \"${MAKE} aquachain\""
    12  	@echo "Building default aquachain. Consider \"${MAKE} musl\""
    13  	CGO_ENABLED=0 build/env.sh go run build/ci.go install ./cmd/aquachain
    14  	@echo "Done building."
    15  	@echo "Run \"$(GOBIN)/aquachain\" to launch aquachain."
    16  
    17  aquachain:
    18  	@echo "Building aquachain with no usb support. Consider \"${MAKE} usb\""
    19  	@echo "Building default aquachain. Consider \"${MAKE} musl\""
    20  	build/env.sh go run build/ci.go install ./cmd/aquachain
    21  	@echo "Done building."
    22  	@echo "Run \"$(GOBIN)/aquachain\" to launch aquachain."
    23  
    24  # with usb support (hardware wallet)
    25  usb:
    26  	build/env.sh go run build/ci.go install -usb ./cmd/aquachain 
    27  
    28  # static, using musl c lib
    29  musl:
    30  	build/env.sh go run build/ci.go install -static -musl ./cmd/aquachain 
    31  
    32  # static linked binary
    33  static:
    34  	build/env.sh go run build/ci.go install -static ./cmd/aquachain
    35  
    36  # build (WIP) reference stratum client
    37  aquastrat:
    38  	@echo "Building aquastrat, stratum test client"
    39  	build/env.sh go run build/ci.go install -static ./cmd/aquastrat
    40  
    41  # build reference miner
    42  aquaminer:
    43  	build/env.sh go run build/ci.go install -static ./cmd/aquaminer
    44  	@echo "Done building."
    45  	@echo "Run \"$(GOBIN)/aquaminer\" to start mining to localhost:8543 rpc-server."
    46  
    47  # build all tools also see aquachain/x repo
    48  all:
    49  	build/env.sh go run build/ci.go install
    50  
    51  # all tools linked statically
    52  all-static:
    53  	build/env.sh go run build/ci.go install -static
    54  
    55  # all tools built with musl
    56  all-musl:
    57  	build/env.sh go run build/ci.go install -musl -static
    58  
    59  # ci/test stuff
    60  
    61  test: all
    62  	build/env.sh go run build/ci.go test 
    63  
    64  test-musl: musl
    65  	build/env.sh go run build/ci.go test -musl 
    66  
    67  lint: 
    68  	build/env.sh go run build/ci.go lint
    69  clean:
    70  	rm -fr build/_workspace/pkg/ $(GOBIN)/*
    71  	rm -fr build/_workspace/src/ $(GOBIN)/*
    72  	rm -fr /tmp/aqua/_workspace/pkg/ $(GOBIN)/*
    73  	rm -fr /tmp/aqua/_workspace/src/ $(GOBIN)/*
    74  
    75  # The devtools target installs tools required for 'go generate'.
    76  # You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
    77  
    78  devtools:
    79  	env GOBIN= go get golang.org/x/tools/cmd/stringer
    80  	env GOBIN= go get github.com/kevinburke/go-bindata/go-bindata
    81  	env GOBIN= go get github.com/fjl/gencodec
    82  	env GOBIN= go get github.com/golang/protobuf/protoc-gen-go
    83  	env GOBIN= go install gitlab.com/aquachain/x/cmd/abigen
    84  	@type "npm" 2> /dev/null || echo 'Please install node.js and npm'
    85  	@type "solc" 2> /dev/null || echo 'Please install solc'
    86  	@type "protoc" 2> /dev/null || echo 'Please install protoc'
    87  
    88  generate: devtools
    89  	go generate ./...
    90  # build binary that can detect race conditions
    91  race:
    92  	build/env.sh go run build/ci.go install -- -race ./cmd/aquachain/
    93  
    94  # install to $(PREFIX)
    95  install:
    96  	install $(GOBIN)/* $(PREFIX)
    97  
    98  .PHONY: aquachain all test clean
    99  .PHONY: aquaminer aquastrat race install generate lint musl all-musl static
   100  .PHONY: docker-run cross generate devtools
   101  
   102  docker-run:
   103  	mkdir -p ${HOME}/.aquachain-alt
   104  	docker run -it -p 127.0.0.1:8543:8543 -v ${HOME}/.aquachain-alt/:/root/.aquachain aquachain/aquachain:latest -- aquachain -rpc
   105  
   106  cross:
   107  	xgo -image aquachain/xgo -ldflags='-w -s -extldflags -static' -tags 'osusergo netgo static' -pkg cmd/aquachain -targets='windows/*,linux/arm,linux/386,linux/amd64,darwin/amd64' gitlab.com/aquachain/aquachain