forked from android-coco/chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (18 loc) · 638 Bytes
/
Copy pathMakefile
File metadata and controls
26 lines (18 loc) · 638 Bytes
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
#/bin/bash
# This is how we want to name the binary output
OUTPUT=bin/chat_server
SRC=cmd/main.go
# These are the values we want to pass for Version and BuildTime
GITTAG=1.0.0
BUILD_TIME=`date +%Y%m%d%H%M%S`
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS=-ldflags "-X main.Version=${GITTAG} -X main.Build_Time=${BUILD_TIME} -s -w"
local:
rm -f ./bin/chat_server
go build ${LDFLAGS} -o ${OUTPUT} ${SRC}
linux:
rm -f ./bin/chat_server
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags=jsoniter ${LDFLAGS} -o ${OUTPUT} ${SRC}
clean:
rm -f ./bin/chat_server
rm -f ./build/chat_server_*