## 项目通用变量 ## 项目通用变量
# git 参数 # git 参数
GIT_VERSION=$(shell git tag | grep $(APP_NAME)-v | sort -r --version-sort | head -n1) GIT_VERSION=$(shell git tag | grep $(APP_NAME)-v | sort -r --version-sort | head -n1)
GIT_COMMIT_ID=$(shell git rev-parse --short=8 HEAD) GIT_COMMIT_ID=$(shell git rev-parse --short=8 HEAD)
GIT_BRANCH=$(shell git branch | sed -n -e 's/^\* \(.*\)/\1/p') GIT_BRANCH=$(shell git branch | sed -n -e 's/^\* \(.*\)/\1/p')
GIT_MASTER_DIFF=$(shell git log --no-merges -q origin/master ^$(GIT_BRANCH) | grep commit)
check_commit:
@echo $(GIT_MASTER_DIFF)
@[ $${#GIT_MASTER_DIFF} -lt 1 ] || { echo "当前分支未合并origin/master所有commits,请先git rebase origin/master"; false; }
# makefile真实(realpath)路径
export ROOT_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
.PHONY作用
If you describe something as phoney, you disapprove of it because it is false rather than genuine. .PHONY后面的target表示的也是一个伪造的target, 而不是真实存在的文件target,注意Makefile的target默认是文件。 避免命令与真实文件冲突
https://www.cnblogs.com/idorax/p/9306528.html
传递参数
make run arg1=asd