未验证 提交 cecfbbec 编写于 作者: C chnliyong 提交者: GitHub

fix Makefile to pass revision when git- clone with --depth or --no-tags (#151)

* fix Makefile to pass revision when git- clone with --depth or --no-tags

* fix libjfs make revision
上级 040464a9
......@@ -11,6 +11,9 @@ ifneq ($(strip $(VERSION)),)
LDFLAGS += -X $(PKG).revision=$(REVISION) \
-X $(PKG).revisionDate=$(REVISIONDATE) \
-X $(PKG).version=$(VERSION)
else ifneq ($(strip $(REVISION)),) # Use git clone with --depth or --no-tags
LDFLAGS += -X $(PKG).revision=$(REVISION) \
-X $(PKG).revisionDate=$(REVISIONDATE)
endif
SHELL = /bin/sh
......
......@@ -14,6 +14,20 @@ endif
all: target/libjfs.so.gz
REVISION := $(shell git rev-parse --short HEAD 2>/dev/null)
REVISIONDATE := $(shell git log -1 --pretty=format:'%ad' --date short 2>/dev/null)
VERSION := $(shell git describe --tags --match 'v*' 2>/dev/null | sed -e 's/^v//' -e 's/-g[0-9a-f]\{7,\}$$//')
PKG := github.com/juicedata/juicefs/pkg/version
LDFLAGS = -s -w
ifneq ($(strip $(VERSION)),)
LDFLAGS += -X $(PKG).revision=$(REVISION) \
-X $(PKG).revisionDate=$(REVISIONDATE) \
-X $(PKG).version=$(VERSION)
else ifneq ($(strip $(REVISION)),) # Use git clone with --depth or --no-tags
LDFLAGS += -X $(PKG).revision=$(REVISION) \
-X $(PKG).revisionDate=$(REVISIONDATE)
endif
target/libjfs.so.gz: libjfs.so
mkdir -p target
gzip -c libjfs.so > target/libjfs.so.gz
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册