Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (59 loc) · 1.63 KB
/
Copy pathMakefile
File metadata and controls
75 lines (59 loc) · 1.63 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
66
67
68
69
70
71
72
73
74
# Makefile for the Godis Hivemind Platform
.PHONY: all build clean run test help
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOTEST=$(GOCMD) test
GOCLEAN=$(GOCMD) clean
GORUN=$(GOCMD) run
# Service names
COORDINATOR=coordinator
NODE=node
CLI=cli
# Directories
CMD_DIR=./cmd
all: build
# Build binaries
build: build-coordinator build-node build-cli
build-coordinator:
@echo "Building coordinator..."
@$(GOBUILD) -o build/$(COORDINATOR) $(CMD_DIR)/$(COORDINATOR)/main.go
build-node:
@echo "Building node..."
@$(GOBUILD) -o build/$(NODE) $(CMD_DIR)/$(NODE)/main.go
build-cli:
@echo "Building cli..."
@$(GOBUILD) -o build/$(CLI) $(CMD_DIR)/$(CLI)/main.go
# Run services
run: run-coordinator
run-coordinator:
@echo "Running coordinator..."
@$(GORUN) $(CMD_DIR)/$(COORDINATOR)/main.go
run-node:
@echo "Running node..."
@$(GORUN) $(CMD_DIR)/$(NODE)/main.go
# Clean build artifacts
clean:
@echo "Cleaning..."
@$(GOCLEAN)
@rm -rf build
# Run tests
test:
@echo "Running tests..."
@$(GOTEST) -v ./...
# Help
help:
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@echo " all Build all services"
@echo " build Build all services"
@echo " build-coordinator Build the coordinator service"
@echo " build-node Build the node service"
@echo " build-cli Build the cli tool"
@echo " run Run the coordinator service"
@echo " run-coordinator Run the coordinator service"
@echo " run-node Run the node service"
@echo " clean Clean build artifacts"
@echo " test Run tests"
@echo " help Show this help message"