diff --git a/.gitignore b/.gitignore index 37f034c6..a3e8e98c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ coverage.out ipfs-cluster-service/ipfs-cluster-service ipfs-cluster-ctl/ipfs-cluster-ctl +deptools # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o diff --git a/Makefile b/Makefile index 224b91d3..0fe70eac 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,16 @@ -all: server client +gx_version=v0.10.0 +gx-go_version=v1.4.0 +gx=gx_$(gx_version) +gx-go=gx-go_$(gx-go_version) +gx_bin=deptools/$(gx) +gx-go_bin=deptools/$(gx-go) +bin_env=$(shell go env GOHOSTOS)-$(shell go env GOHOSTARCH) + +all: service ctl clean: rwundo $(MAKE) -C ipfs-cluster-service clean $(MAKE) -C ipfs-cluster-ctl clean + rm -rf deptools install: deps $(MAKE) -C ipfs-cluster-service install $(MAKE) -C ipfs-cluster-ctl install @@ -16,22 +25,37 @@ service: deps ctl: deps $(MAKE) -C ipfs-cluster-ctl ipfs-cluster-ctl -gx: - go get github.com/whyrusleeping/gx - go get github.com/whyrusleeping/gx-go +$(gx_bin): + @echo "Downloading gx" + @mkdir -p ./deptools + @wget -nc -q -O $(gx_bin).tgz https://dist.ipfs.io/gx/$(gx_version)/$(gx)_$(bin_env).tar.gz + @tar -zxf $(gx_bin).tgz -C deptools --strip-components=1 gx/gx + @mv deptools/gx $(gx_bin) + @rm $(gx_bin).tgz + +$(gx-go_bin): + echo "Downloading gx-go" + mkdir -p ./deptools + wget -nc -q -O $(gx-go_bin).tgz https://dist.ipfs.io/gx-go/$(gx-go_version)/$(gx-go)_$(bin_env).tar.gz + tar -zxf $(gx-go_bin).tgz -C deptools --strip-components=1 gx-go/gx-go + mv deptools/gx-go $(gx-go_bin) + rm $(gx-go_bin).tgz + +gx: $(gx_bin) $(gx-go_bin) + deps: gx go get github.com/gorilla/mux go get github.com/hashicorp/raft go get github.com/hashicorp/raft-boltdb go get github.com/ugorji/go/codec - gx --verbose install --global - gx-go rewrite + $(gx_bin) --verbose install --global + $(gx-go_bin) rewrite test: deps go test -tags silent -v -covermode count -coverprofile=coverage.out . rw: - gx-go rewrite + $(gx-go_bin) rewrite rwundo: - gx-go rewrite --undo + $(gx-go_bin) rewrite --undo publish: rwundo - gx publish + $(gx_bin) publish .PHONY: all gx deps test rw rwundo publish service ctl install clean