Skip to content

Instantly share code, notes, and snippets.

@poying
Created February 5, 2015 11:35
Show Gist options
  • Save poying/537188d4ea35d890a019 to your computer and use it in GitHub Desktop.
Save poying/537188d4ea35d890a019 to your computer and use it in GitHub Desktop.
PROJNAME = redis-mount
SERVICEPATH = github.com/poying
SOURCES = main.go help_template.go
GOPATH = $(shell pwd)
PROJPATH = src/$(SERVICEPATH)/$(PROJNAME)
BINFILE = ./$(PROJNAME)
define build
echo build $(PROJNAME)-$(1)-$(2); \
GO_ENABLED=0 GOOS=$(1) GOARCH=$(2) go build -o "bin/$(PROJNAME)-$(1)-$(2)" $(SOURCES);
endef
RUN_ARGS=$(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
all: test clean
test: init $(BINFILE)
@mkdir -p test-data
@$(BINFILE) test-data >/dev/null 2>&1 &
@go test -v ./redisfs/...
@$(BINFILE) --unmount test-data
@rm -r test-data
run:
@go run $(ENTRYPOINT) $(RUN_ARGS)
cross:
@$(call build,linux,amd64)
@$(call build,linux,386)
@$(call build,linux,arm)
@$(call build,darwin,amd64)
$(BINFILE):
@go build -o redis-mount
install:
@go install
init: get-deps $(PROJPATH)
get-deps:
@go get bazil.org/fuse
@go get gopkg.in/fatih/set.v0
@go get github.com/codegangsta/cli
@go get github.com/stretchr/testify
@go get github.com/garyburd/redigo/redis
$(PROJPATH):
@mkdir -p $(dir $@)
@ln -s $(GOPATH) $@
clean:
-@rm -rf bin src pkg $(BINFILE)
.PHONY: $(BINFILE)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment