-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·65 lines (53 loc) · 1.68 KB
/
Makefile
File metadata and controls
executable file
·65 lines (53 loc) · 1.68 KB
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
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
BINARY_NAME=KvsDns
# Database config
# Select from cassandra,redis,etcd
DB=cassandra
ifeq ($(DB),cassandra)
CLUSTER_IPS="192.168.0.240,192.168.0.241,192.168.0.242"
else
ifeq ($(DB),redis)
CLUSTER_IPS="192.168.0.240:7001,192.168.0.240:7002,192.168.0.241:7003,192.168.0.241:7004,192.168.0.242:7005,192.168.0.242:7006"
else
CLUSTER_IPS="192.168.0.240:2379,192.168.0.241:2379,192.168.0.242:2379"
endif
endif
CPU_NUMBER=4
RUN_DB=run_$(DB)
STOP_DB=stop_$(DB)
ANSIBLE_DIR=./scripts/ansible
build:
@$(GOBUILD) -o $(BINARY_NAME) -v
test:
@$(GOTEST) -v ./...
clean: $(STOP_DB)
$(GOCLEAN)
@rm -f $(BINARY_NAME)
run: $(RUN_DB)
$(GOBUILD) -o $(BINARY_NAME) -v
./$(BINARY_NAME) --clusterIPs $(CLUSTER_IPS) --print --soreuseport $(CPU_NUMBER) --cpu $(CPU_NUMBER) --db $(DB)
run_standalone:
$(GOBUILD) -o $(BINARY_NAME) -v
./$(BINARY_NAME) --clusterIPs $(CLUSTER_IPS) --print --soreuseport $(CPU_NUMBER) --cpu $(CPU_NUMBER) --db $(DB)
build_cmd: build_requester build_uploader
build_requester:
@cd cmd/dnsrequester && $(GOBUILD) -v
build_uploader:
@cd cmd/queryuploader && $(GOBUILD) -v
# Key value store targets using ansible
run_cassandra:
@cd $(ANSIBLE_DIR) && ansible-playbook -K playbooks/cassandra_up.yml
stop_cassandra:
@cd $(ANSIBLE_DIR) && ansible-playbook -K playbooks/cassandra_down.yml
run_redis:
@cd $(ANSIBLE_DIR) && ansible-playbook -K playbooks/redis_up.yml
stop_redis:
@cd $(ANSIBLE_DIR) && ansible-playbook -K playbooks/redis_down.yml
run_etcd:
@cd $(ANSIBLE_DIR) && ansible-playbook -K playbooks/etcd_up.yml
stop_etcd:
@cd $(ANSIBLE_DIR) && ansible-playbook -K playbooks/etcd_down.yml