-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (39 loc) · 1.04 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
# Target name (executable file)
TARGET = p2p-snake-node
# Paths and variables
SRC_DIR = ../cmd/p2p-snake
BUILD_DIR = ./
GO = go
PROTOC = protoc
# Generate code for protobuf
.PHONY: protobuf
protobuf:
@echo "Generating code for protobuf..."
$(PROTOC) -I=../protocol --go_out=../internal ../protocol/p2p.proto
# Cleaning generated files
.PHONY: clean
clean:
@echo "Cleaning the executable file..."
@rm -f $(TARGET)
# Building the executable file
.PHONY: build
build: clean
@echo "Building the executable file..."
$(GO) mod download
$(GO) build $(BUILD_FLAGS) -o $(TARGET) $(SRC_DIR)
# Help (display available commands)
.PHONY: help
help:
@echo "Available commands:"
@echo " make protobuf"
@echo " Generate code for protobuf"
@echo " make clean"
@echo " Clean generated files"
@echo " make build"
@echo " Build the executable file"
@echo " make run"
@echo " Run the built executable file"
@echo " make help"
@echo " Display this message"
# Default action is to display help
.DEFAULT_GOAL := help