Makefile 729 Bytes
Newer Older
“李磊”'s avatar
“李磊” committed
1
2
3
4
5
6
7
8
9
10
11
.pre-build:
	mkdir -p bin/

# all=表示对所有go包应用后面的表示标志
# -N 禁用优化
# -l 禁用内联
# -ldflags 用来设置链接器的标志
# -X 在编译时设置包中的变量的值
build: .pre-build
	go build -gcflags='all=-N -l' -ldflags "-X agent/cmd/agent/config.Version=`./branch_info.sh get_version` -X agent/cmd/agent/config.BuildCommit=`git rev-list -1 HEAD`" -o bin/linkfog_agent ./cmd/agent
	bin/linkfog_agent -v | tee version
Lei Li's avatar
Lei Li committed
12
13
14
15

build-dev: .pre-build
	go build -tags dev -gcflags='all=-N -l' -ldflags "-X agent/cmd/agent/config.Version=`./branch_info.sh get_version` -X agent/cmd/agent/config.BuildCommit=`git rev-list -1 HEAD`" -o bin/linkfog_agent ./cmd/agent
	bin/linkfog_agent -v | tee version