-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
72 lines (52 loc) · 1.68 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
BINARY = goromdb
ifeq ($(shell uname -s),Darwin)
MD5 = md5 -r
else
MD5 = md5sum
endif
DB_FILES = \
sample-data.json sample-bdb.db sample-memcachedb-bdb.db sample-boltdb.db \
sample-ns-data.json sample-ns-boltdb.db
DB_DIR = _data/store
DB_PATHS = $(addprefix $(DB_DIR)/,$(DB_FILES))
MD5_PATHS = $(foreach path,$(DB_PATHS),$(path).md5)
all:
$(MAKE) -j 4 dep $(DB_DIR)
$(MAKE) -j 4 $(DB_PATHS) $(MD5_PATHS) $(BINARY)
dep:
which dep || go get -u -v github.com/golang/dep/cmd/dep
dep ensure -v
$(DB_DIR):
mkdir -p $@
$(DB_DIR)/%.md5: $(DB_DIR)/%
$(MD5) $< > $@
$(DB_DIR)/sample-data.json: _data/sample-data.json
cp $< $@
$(DB_DIR)/sample-bdb.db: _data/sample-data.json
go run ./_cmd/sample-data/bdb/bdb.go -input-from $< -output-to $@
$(DB_DIR)/sample-memcachedb-bdb.db: _data/sample-data.json
go run ./_cmd/sample-data/memcachedb-bdb/memcachedb-bdb.go -input-from $< -output-to $@
$(DB_DIR)/sample-boltdb.db: _data/sample-data.json
go run ./_cmd/sample-data/boltdb/boltdb.go -input-from $< -output-to $@
$(DB_DIR)/sample-ns-data.json: _data/sample-ns-data.json
cp $< $@
$(DB_DIR)/sample-ns-boltdb.db: _data/sample-ns-data.json
go run ./_cmd/sample-data/nsboltdb/nsboltdb.go -input-from $< -output-to $@
$(BINARY):
go build
test:
go vet ./...
go test ./...
lint: golint gocyclo
golint:
which golint || go get -u -v golang.org/x/lint/golint
go list ./... | xargs golint
gocyclo:
which gocyclo || go get -u -v github.com/fzipp/gocyclo
find . -maxdepth 1 -mindepth 1 -type d -regex "\.\/[a-z].*" | grep -v vendor | xargs gocyclo -over 15
clean:
go clean -testcache
rm -rf $(BINARY) $(DB_PATHS) $(MD5_PATHS)
realclean: clean
rm -rf vendor
.PHONY: all dep test lint golint clean realclean