Skip to content

Commit

Permalink
Makefile: VERSION uses "~" for "-" in git tags
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tramjoe committed May 19, 2014
1 parent b270ac8 commit 7eedb6e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@

NAME = rtslib
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:"
Expand Down Expand Up @@ -95,7 +101,7 @@ build/release-stamp:
rm -r 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}'); \
Expand All @@ -105,7 +111,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 \
Expand Down

0 comments on commit 7eedb6e

Please sign in to comment.