-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (36 loc) · 1.18 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
BIN_DIR = bin
PROTO_DIR = proto
SERVER_DIR = cmd/orders
CLIENT_DIR = client
ifeq ($(OS), Windows_NT)
SERVER_BIN = ${SERVER_DIR}.exe
CLIENT_BIN = ${CLIENT_DIR}.exe
else
SERVER_BIN = ${SERVER_DIR}
CLIENT_BIN = ${CLIENT_DIR}
endif
PACKAGE = $(shell head -1 go.mod | awk '{print $$2}')
.DEFAULT_GOAL := help
.PHONY: help proto clean clean_orders build about
build:
@${CHECK_DIR_CMD}
protoc -I${PROTO_DIR} --go_opt=module=${PACKAGE} --go_out=. --go-grpc_opt=module=${PACKAGE} --go-grpc_out=. ${PROTO_DIR}/*.proto
go build -o ${BIN_DIR}/cmd/orders ./${SERVER_DIR}
go build -o ${BIN_DIR}/${CLIENT_DIR}/${CLIENT_BIN} ./${CLIENT_DIR}
clean: clean_orders ## Clean generated files
${RM_F_CMD} ssl/*.crt
${RM_F_CMD} ssl/*.csr
${RM_F_CMD} ssl/*.key
${RM_F_CMD} ssl/*.pem
${RM_RF_CMD} ${BIN_DIR}
clean_orders: ## Clean generated files for orders
${RM_F_CMD} ${PROTO_DIR}/*.pb.go
about: ## Display info related to the build
@echo "OS: ${OS}"
@echo "Shell: ${SHELL} ${SHELL_VERSION}"
@echo "Protoc version: $(shell protoc --version)"
@echo "Go version: $(shell go version)"
@echo "Go package: ${PACKAGE}"
@echo "Openssl version: $(shell openssl version)"
help: ## Show this help
@${HELP_CMD}