-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (27 loc) · 1.06 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
# variable
binaryName=cyber
versionPath=github.com/haormj/version
version=v0.1.0
outputPath=output
workingDirectory=$(shell pwd)
GOENV=${workingDirectory}/go.env
GOBUILD=GOENV=${GOENV} go build
all: build
build: clean
@buildTime=`date "+%Y-%m-%d %H:%M:%S"`; \
$(GOBUILD) -ldflags "-X '${versionPath}.Version=${version}' \
-X '${versionPath}.BuildTime=$$buildTime' \
-X '${versionPath}.GoVersion=`go version`' \
-X '${versionPath}.GitCommit=`git rev-parse --short HEAD`'" -o ${outputPath}/mainboard ./cmd/mainboard/
@buildTime=`date "+%Y-%m-%d %H:%M:%S"`; \
$(GOBUILD) -ldflags "-X '${versionPath}.Version=${version}' \
-X '${versionPath}.BuildTime=$$buildTime' \
-X '${versionPath}.GoVersion=`go version`' \
-X '${versionPath}.GitCommit=`git rev-parse --short HEAD`'" -o ${outputPath}/recorder ./cmd/recorder/
run: build
./${outputPath}/
proto:
protoc -I=./proto/ --go_out=./ ./proto/*.proto
clean:
@rm -rf ${outputPath}
.PHONY: all build run clean proto