github.com/klaytn/klaytn@v1.12.1/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 GO ?= latest 6 GOPATH := $(or $(GOPATH), $(shell go env GOPATH)) 7 GORUN = env GOPATH=$(GOPATH) GO111MODULE=on go run 8 9 BIN = $(shell pwd)/build/bin 10 BUILD_PARAM?=install 11 12 OBJECTS=kcn kpn ken kscn kspn ksen kbn kgen homi 13 14 .PHONY: all test clean ${OBJECTS} 15 16 all: ${OBJECTS} 17 18 ${OBJECTS}: 19 ifeq ($(USE_ROCKSDB), 1) 20 $(GORUN) build/ci.go ${BUILD_PARAM} -tags rocksdb ./cmd/$@ 21 else 22 $(GORUN) build/ci.go ${BUILD_PARAM} ./cmd/$@ 23 endif 24 25 abigen: 26 $(GORUN) build/ci.go ${BUILD_PARAM} ./cmd/abigen 27 @echo "Done building." 28 @echo "Run \"$(BIN)/abigen\" to launch abigen." 29 30 test: 31 $(GORUN) build/ci.go test 32 33 test-seq: 34 $(GORUN) build/ci.go test -p 1 35 36 test-datasync: 37 $(GORUN) build/ci.go test -p 1 ./datasync/... 38 39 test-networks: 40 $(GORUN) build/ci.go test -p 1 ./networks/... 41 42 test-node: 43 $(GORUN) build/ci.go test -p 1 ./node/... 44 45 test-tests: 46 $(GORUN) build/ci.go test -p 1 ./tests/... 47 48 test-others: 49 $(GORUN) build/ci.go test -p 1 -exclude datasync,networks,node,tests 50 51 cover: 52 $(GORUN) build/ci.go cover -coverprofile=coverage.out 53 go tool cover -func=coverage.out -o coverage_report.txt 54 go tool cover -html=coverage.out -o coverage_report.html 55 @echo "Two coverage reports coverage_report.txt and coverage_report.html are generated." 56 57 lint: 58 $(GORUN) build/ci.go lint 59 60 lint-try: 61 $(GORUN) build/ci.go lint-try 62 63 clean: 64 env GO111MODULE=on go clean -cache 65 rm -fr build/_workspace/pkg/ $(BIN)/* build/_workspace/src/ 66 67 # The devtools target installs tools required for 'go generate'. 68 # You need to put $BIN (or $GOPATH/bin) in your PATH to use 'go generate'. 69 70 devtools: 71 env GOFLAGS= GOBIN= go get -u golang.org/x/tools/cmd/stringer 72 env GOFLAGS= GOBIN= go get -u github.com/kevinburke/go-bindata/go-bindata 73 env GOFLAGS= GOBIN= go get -u github.com/fjl/gencodec 74 env GOFLAGS= GOBIN= go get -u github.com/golang/protobuf/protoc-gen-go 75 env GOFLAGS= GOBIN= go install ./cmd/abigen 76 @type "npm" 2> /dev/null || echo 'Please install node.js and npm' 77 @type "solc" 2> /dev/null || echo 'Please install solc' 78 @type "protoc" 2> /dev/null || echo 'Please install protoc'