forked from aceld/zinx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (23 loc) · 1.07 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
.PHONY: build
SERVICE := zinx
CUR_PWD := $(shell pwd)
SERVER_DEMO_PATH := $(CUR_PWD)/examples/zinx_server
CLIENT_DEMO_PATH := $(CUR_PWD)/examples/zinx_client
SERVER_DEMO_BIN := $(SERVER_DEMO_PATH)/server
CLIENT_DEMO_BIN := $(CLIENT_DEMO_PATH)/client
AUTHOR := $(shell git log --pretty=format:"%an"|head -n 1)
VERSION := $(shell git rev-list HEAD | head -1)
BUILD_INFO := $(shell git log --pretty=format:"%s" | head -1)
BUILD_DATE := $(shell date +%Y-%m-%d\ %H:%M:%S)
export GO111MODULE=on
LD_FLAGS='-X "$(SERVICE)/version.TAG=$(TAG)" -X "$(SERVICE)/version.VERSION=$(VERSION)" -X "$(SERVICE)/version.AUTHOR=$(AUTHOR)" -X "$(SERVICE)/version.BUILD_INFO=$(BUILD_INFO)" -X "$(SERVICE)/version.BUILD_DATE=$(BUILD_DATE)"'
TEST_FILES := znet/acceptdelay_test.go znet/acceptdelay.go
default: build
build:
go build -ldflags $(LD_FLAGS) -gcflags "-N" -o $(SERVER_DEMO_BIN) $(SERVER_DEMO_PATH)/main.go
go build -ldflags $(LD_FLAGS) -gcflags "-N" -o $(CLIENT_DEMO_BIN) $(CLIENT_DEMO_PATH)/main.go
test:
go test -v -cover $(TEST_FILES)
clean:
rm $(SERVER_DEMO_BIN)
rm $(CLIENT_DEMO_BIN)