1 Star 0 Fork 0

linuxr/rc

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
linuxr 提交于 2017-09-17 16:19 . update Makefile
# 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"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/wangyubin/rc.git
[email protected]:wangyubin/rc.git
wangyubin
rc
rc
master

搜索帮助