-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (39 loc) · 998 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
PROJNAME = necourse
SERVICEPATH = github.com/poying
SOURCES = $(wildcard *.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 $(SOURCES) $(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 github.com/tj/go-spin
@go get github.com/codegangsta/cli
$(PROJPATH):
@mkdir -p $(dir $@)
@ln -s $(GOPATH) $@
clean:
-@rm -rf bin src pkg $(BINFILE)
.PHONY: $(BINFILE)