Permalink
Browse files

Add Makefile

  • Loading branch information...
sammy007 committed Jun 16, 2016
1 parent 7ecfdee commit b43f6205012b7c400672e15c68d0cced040b4c96
Showing with 51 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +16 −0 Makefile
  3. +32 −0 build/env.sh
View
@@ -5,3 +5,6 @@ ether-pool
ether-pool.exe
logs
tools
+
+/build/_workspace/
+/build/bin/
View
@@ -0,0 +1,16 @@
+# This Makefile is meant to be used by people that do not usually work
+# with Go source code. If you know what GOPATH is then you probably
+# don't need to bother with make.
+
+.PHONY: all test clean
+
+GOBIN = build/bin
+
+all:
+ build/env.sh go get -v ./...
+
+test: all
+ build/env.sh go test -v ./...
+
+clean:
+ rm -fr build/_workspace/pkg/ $(GOBIN)/*
View
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+set -e
+
+if [ ! -f "build/env.sh" ]; then
+ echo "$0 must be run from the root of the repository."
+ exit 2
+fi
+
+# Create fake Go workspace if it doesn't exist yet.
+workspace="$PWD/build/_workspace"
+root="$PWD"
+ethdir="$workspace/src/github.com/sammy007"
+if [ ! -L "$ethdir/open-ethereum-pool" ]; then
+ mkdir -p "$ethdir"
+ cd "$ethdir"
+ ln -s ../../../../../. open-ethereum-pool
+ cd "$root"
+fi
+
+# Set up the environment to use the workspace.
+# Also add Godeps workspace so we build using canned dependencies.
+GOPATH="$workspace"
+GOBIN="$PWD/build/bin"
+export GOPATH GOBIN
+
+# Run the command inside the workspace.
+cd "$ethdir/open-ethereum-pool"
+PWD="$ethdir/open-ethereum-pool"
+
+# Launch the arguments with the configured environment.
+exec "$@"

0 comments on commit b43f620

Please sign in to comment.