use git version information if possible, otherwise use information

from (I3_)VERSION files (for tarballs)
This commit is contained in:
Johannes Lange 2016-04-03 14:38:08 +02:00
parent 9f27716d16
commit f74327e7c6
1 changed files with 8 additions and 6 deletions

View File

@ -18,12 +18,14 @@ ifndef SYSCONFDIR
endif endif
endif endif
# In dist tarballs, the version is stored in the I3_VERSION and VERSION files. # In dist and snapshot tarballs, use the I3_VERSION and VERSION files. Otherwise use git information.
I3_VERSION := '$(shell [ -f $(TOPDIR)/I3_VERSION ] && cat $(TOPDIR)/I3_VERSION)' ifeq ($(wildcard .git),)
VERSION := '$(shell [ -f $(TOPDIR)/VERSION ] && cat $(TOPDIR)/VERSION)' # not in git repository
ifeq ('',$(I3_VERSION)) VERSION := '$(shell [ -f $(TOPDIR)/VERSION ] && cat $(TOPDIR)/VERSION)'
VERSION := $(shell git describe --tags --abbrev=0) I3_VERSION := '$(shell [ -f $(TOPDIR)/I3_VERSION ] && cat $(TOPDIR)/I3_VERSION)'
I3_VERSION := '$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch \"$(shell git describe --tags --always --all | sed s:heads/::)\")' else
VERSION := $(shell git describe --tags --abbrev=0)
I3_VERSION := '$(shell git describe --tags --always) ($(shell git log --pretty=format:%cd --date=short -n1), branch \"$(shell git describe --tags --always --all | sed s:heads/::)\")'
endif endif
MAJOR_VERSION := $(shell echo ${VERSION} | cut -d '.' -f 1) MAJOR_VERSION := $(shell echo ${VERSION} | cut -d '.' -f 1)