代码拉取完成,页面将自动刷新
# makefile
# build with git revision number
# example: gb build -ldflags "-X main.build=`git rev-parse HEAD`" cmd/xxx
# varible
CMD = rc
CURRENT_REVISION = `git rev-parse HEAD`
LD_FLAGS := "-X main.build=$(CURRENT_REVISION)"
BIN_CMD = ../../bin/${CMD}
RELEASE_DIR = ./release
# target
all: cmd
# release
release:
@echo "[begin] release ==================="
GOOS=darwin GOARCH=amd64 go build -ldflags ${LD_FLAGS} -o ${CMD}-darwin-amd64
GOOS=linux GOARCH=amd64 go build -ldflags ${LD_FLAGS} -o ${CMD}-linux-amd64
GOOS=windows GOARCH=amd64 go build -ldflags ${LD_FLAGS} -o ${CMD}-windows-amd64.exe
tar czvf release.tar.gz ${CMD}-darwin-amd64 ${CMD}-windows-amd64.exe ${CMD}-linux-amd64
@echo "[end] release ==================="
cmd: clean
@echo "[begin] build rc ==================="
go install -ldflags ${LD_FLAGS}
@echo "[end ] build rc ==================="
.PHONY: clean
clean:
rm -f ${BIN_CMD}
rm -f ${CMD}-darwin-amd64
rm -f ${CMD}-windows-amd64.exe
rm -f ${CMD}-linux-amd64
help:
@echo "make [option]: "
@echo "\t all : compile for all binaries"
@echo "\t release : generate tar file with compiled binary(windows, linux, osx)"
@echo "\t cmd : compile for main command"
@echo "\t clean : clean files which are generated by compile"
@echo "\t help : print this help info"
@echo "\n"
@echo "make == make all"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。