We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
参考博主文章https://zhuanlan.zhihu.com/p/88688319
.PHONY: all build deploy help BINARY=$(shell basename "$(PWD)") WORKDIR=`pwd` default: deploy CUR_DIR := $(shell pwd) CUR_TIME := $(shell date +"%Y-%m-%d_%H:%M.%S") # 获取git tag版本号 GitTag :=$(shell git tag --sort=version:refname | tail -n 1) # 获取源码最近一次git commit log,包含commit sha 值,以及commit message GitCommitLog :=$(shell git log --pretty=oneline -n 1) # 将log原始字符串中的单引号替换成双引号 # GitCommitLog :=${GitCommitLog//\'/\"} # 检查源码在git commit基础上,是否有本地修改,且未提交的内容 GitStatus := $(shell git status -s) # 获取当前时间 BuildTime := $(shell date +"%Y-%m-%d_%H:%M.%S") # 获取Go的版本 BuildGoVersion := $(shell go version) LDFLAGS=-ldflags "-s -w \ -X 'github.com/q191201771/naza/pkg/bininfo.GitCommitLog=${GitCommitLog}' \ -X 'github.com/q191201771/naza/pkg/bininfo.GitStatus=${GitStatus}' \ -X 'github.com/q191201771/naza/pkg/bininfo.BuildTime=${BuildTime}' \ -X 'github.com/q191201771/naza/pkg/bininfo.BuildGoVersion=${BuildGoVersion}' \ " all: @echo $(CUR_DIR) @echo $(CUR_TIME) build: go build ./ deploy: @echo "build notify" @echo ${LDFLAGS} @go build -o ${BINARY} -v ${LDFLAGS} help: @echo "make 格式化go代码 并编译生成二进制文件" @echo "make build 编译go代码生成二进制文件" @echo "make deploy 生成二进制文件并发布"
The text was updated successfully, but these errors were encountered:
No branches or pull requests
参考博主文章https://zhuanlan.zhihu.com/p/88688319
The text was updated successfully, but these errors were encountered: