forked from yowcow/goromdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
54 lines (38 loc) · 1.08 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
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
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:
dep ensure -v
test:
go test ./...
$(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 $@
bench:
go test -bench .
$(BINARY):
go build
clean:
rm -rf $(BINARY) $(DB_PATHS) $(MD5_PATHS)
realclean: clean
rm -rf vendor
.PHONY: dep test bench clean realclean