Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Commit

Permalink
Makefile and README updates (#49)
Browse files Browse the repository at this point in the history
* wip makefile updates

* Fixed makefile and updated README

* Fixed readme changes

* Added go module documentation and fixed wiki links to EP

* Added go modules on for makefile commands and documentation
  • Loading branch information
austinabell authored and soc1c committed Jun 12, 2019
1 parent 6c6454e commit a97a13a
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 100 deletions.
52 changes: 16 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,86 +5,66 @@ SOURCE_FILES?=$$(go list ./... | grep -v /vendor/)
TEST_PATTERN?=.
TEST_OPTIONS?=-race

GO_MOD=GO111MODULE=on

BINARY=bin
BUILD_TIME=`date +%FT%T%z`
COMMIT=`git log --pretty=format:'%h' -n 1`

# Choose to install geth with or without SputnikVM.
WITH_SVM?=1

# Provide default value of GOPATH, if it's not set in environment
export GOPATH?=${HOME}/go

LDFLAGS=-ldflags "-X main.Version="`git describe --tags`

setup: ## Install all the build and lint dependencies
go get -u github.com/alecthomas/gometalinter
go get -u github.com/golang/dep/...
go get -u github.com/pierrre/gotestcover
go get -u golang.org/x/tools/cmd/cover
go get -u github.com/omeid/go-resources/cmd/resources
dep ensure
gometalinter --install

build: cmd/abigen cmd/bootnode cmd/disasm cmd/ethtest cmd/evm cmd/gethrpctest cmd/rlpdump cmd/geth ## Build a local snapshot binary version of all commands
@ls -ld $(BINARY)/*

cmd/geth: chainconfig ## Build a local snapshot binary version of geth. Use WITH_SVM=0 to disable building with SputnikVM (default: WITH_SVM=1)
ifeq (${WITH_SVM}, 1)
./scripts/build_sputnikvm.sh build
else
cmd/geth: chainconfig ## Build a local snapshot binary version of geth.
mkdir -p ./${BINARY}
go build ${LDFLAGS} -o ${BINARY}/geth -tags="netgo" ./cmd/geth
endif
${GO_MOD} go build -o ${BINARY}/geth -tags="netgo" ./cmd/geth
@echo "Done building geth."
@echo "Run \"$(BINARY)/geth\" to launch geth."

cmd/abigen: ## Build a local snapshot binary version of abigen.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/abigen ./cmd/abigen
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/abigen ./cmd/abigen
@echo "Done building abigen."
@echo "Run \"$(BINARY)/abigen\" to launch abigen."

cmd/bootnode: ## Build a local snapshot of bootnode.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/bootnode ./cmd/bootnode
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/bootnode ./cmd/bootnode
@echo "Done building bootnode."
@echo "Run \"$(BINARY)/bootnode\" to launch bootnode."

cmd/disasm: ## Build a local snapshot of disasm.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/disasm ./cmd/disasm
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/disasm ./cmd/disasm
@echo "Done building disasm."
@echo "Run \"$(BINARY)/disasm\" to launch disasm."

cmd/ethtest: ## Build a local snapshot of ethtest.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/ethtest ./cmd/ethtest
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/ethtest ./cmd/ethtest
@echo "Done building ethtest."
@echo "Run \"$(BINARY)/ethtest\" to launch ethtest."

cmd/evm: ## Build a local snapshot of evm.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/evm ./cmd/evm
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/evm ./cmd/evm
@echo "Done building evm."
@echo "Run \"$(BINARY)/evm\" to launch evm."

cmd/gethrpctest: ## Build a local snapshot of gethrpctest.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/gethrpctest ./cmd/gethrpctest
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/gethrpctest ./cmd/gethrpctest
@echo "Done building gethrpctest."
@echo "Run \"$(BINARY)/gethrpctest\" to launch gethrpctest."

cmd/rlpdump: ## Build a local snapshot of rlpdump.
mkdir -p ./${BINARY} && go build ${LDFLAGS} -o ${BINARY}/rlpdump ./cmd/rlpdump
mkdir -p ./${BINARY} && ${GO_MOD} go build -o ${BINARY}/rlpdump ./cmd/rlpdump
@echo "Done building rlpdump."
@echo "Run \"$(BINARY)/rlpdump\" to launch rlpdump."

install: ## Install all packages to $GOPATH/bin
go install ./cmd/{abigen,bootnode,disasm,ethtest,evm,gethrpctest,rlpdump}
${GO_MOD} go install ./cmd/{abigen,bootnode,disasm,ethtest,evm,gethrpctest,rlpdump}
$(MAKE) install_geth

install_geth: chainconfig ## Install geth to $GOPATH/bin. Use WITH_SVM=0 to disable building with SputnikVM (default: WITH_SVM=1)
install_geth: chainconfig ## Install geth to $GOPATH/bin
$(info Installing $$GOPATH/bin/geth)
ifeq (${WITH_SVM}, 1)
./scripts/build_sputnikvm.sh install
else
go install ${LDFLAGS} -tags="netgo" ./cmd/geth ; fi
endif
${GO_MOD} go install -tags="netgo" ./cmd/geth

fmt: ## gofmt and goimports all go files
find . -name '*.go' -not -wholename './vendor/*' -not -wholename './_vendor*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
Expand Down Expand Up @@ -112,7 +92,7 @@ lint: ## Run all the linters

test: ## Run all the tests
echo 'mode: atomic' > coverage.txt && \
go list ./... | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp {} && \
${GO_MOD} go list ./... | xargs -n1 -I{} sh -c 'go test -covermode=atomic -coverprofile=coverage.tmp {} && \
tail -n +2 coverage.tmp >> coverage.txt' && \
rm coverage.tmp

Expand All @@ -125,7 +105,7 @@ core/assets/assets.go: ${GOPATH}/bin/resources core/config/*.json core/config/*.
${GOPATH}/bin/resources -fmt -declare -var=DEFAULTS -package=assets -output=core/assets/assets.go core/config/*.json core/config/*.csv

${GOPATH}/bin/resources:
go get -u github.com/omeid/go-resources/cmd/resources
${GO_MOD} go get -u github.com/omeid/go-resources/cmd/resources

clean: ## Remove local snapshot binary directory
if [ -d ${BINARY} ] ; then rm -rf ${BINARY} ; fi
Expand Down
Loading

0 comments on commit a97a13a

Please sign in to comment.