Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Makefile
  • Loading branch information
sammy007 committed Jun 16, 2016
1 parent 7ecfdee commit b43f620
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -5,3 +5,6 @@ ether-pool
ether-pool.exe ether-pool.exe
logs logs
tools tools

/build/_workspace/
/build/bin/
16 changes: 16 additions & 0 deletions Makefile
@@ -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)/*
32 changes: 32 additions & 0 deletions build/env.sh
@@ -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.