summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Martin <jxm@netiant.com>2014-05-19 23:32:59 +0200
committerJerome Martin <jxm@netiant.com>2014-05-19 23:32:59 +0200
commit1ca863c5217c08d281ed30544d0ae8b41e6ff5d7 (patch)
tree74144f133f94045911f5210df1a2fe3aab17595c
parent14e223728bb521b6defc3529e51beaef37eb56fb (diff)
downloadtargetcli-3.0-pre2.tar.gz
Makefile: VERSION uses "~" for "-" in git tags3.0-pre2
* This makes for better version comparison in distributions. In Debian, 3.0~rc1 < 3.0 < 3.0-rc1. * Added version target to display computed version string * Use the same variable for rpm and deb changelogs
-rw-r--r--Makefile12
1 files changed, 9 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 61effa1..365ef23 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,13 @@
NAME = targetcli
GIT_BRANCH = $$(git branch | grep \* | tr -d \*)
-VERSION = $$(basename $$(git describe --tags | tr - . | grep -o '[0-9].*$$'))
+GIT_DESC = $$(basename $$(git describe --tags | grep -o '[0-9].*$$'))
+GIT_LAST_TAG = $$(git describe --tags --abbrev=0 | grep -o '[0-9].*$$')
+GIT_PKG_TAG = $$(echo $(GIT_LAST_TAG) | tr - \~)
+VERSION = $$(echo $(GIT_DESC) | sed s/^$(GIT_LAST_TAG)/$(GIT_PKG_TAG)/)
+
+version:
+ @echo $(VERSION)
all:
@echo "Usage:"
@@ -79,7 +85,7 @@ build/release-stamp:
rmdir rpm
@echo "Generating rpm changelog..."
@( \
- version=$$(basename $$(git describe HEAD --tags | tr - . | grep -o '[0-9].*$$')); \
+ version=$(VERSION); \
author=$$(git show HEAD --format="format:%an <%ae>" -s); \
date=$$(git show HEAD --format="format:%ad" -s \
| awk '{print $$1,$$2,$$3,$$5}'); \
@@ -89,7 +95,7 @@ build/release-stamp:
) >> $$(ls build/${NAME}-${VERSION}/*.spec)
@echo "Generating debian changelog..."
@( \
- version=$$(basename $$(git describe HEAD --tags | tr - . | grep -o '[0-9].*$$')); \
+ version=$(VERSION); \
author=$$(git show HEAD --format="format:%an <%ae>" -s); \
date=$$(git show HEAD --format="format:%aD" -s); \
day=$$(git show HEAD --format='format:%ai' -s \