-version.h:
- if [ -d $(GIT_DIR) ]; then \
- if [ -f $(GIT_DIR)/last_commit_info ]; then \
- echo "#define ENIGMA2_LAST_CHANGE_DATE \"`cat $(GIT_DIR)/last_commit_info | grep 'Date:' | cut -d' ' -f4`\"" > $@; \
- echo "#define ENIGMA2_BRANCH \"`cat $(GIT_DIR)/branch`\"" >> $@; \
- else \
- echo "#define ENIGMA2_LAST_CHANGE_DATE \"`git --git-dir=$(top_srcdir)/.git log --no-color -n 1 --format=format:%cd --date=short`\"" > $@; \
- echo "#define ENIGMA2_BRANCH \"`git --git-dir=$(top_srcdir)/.git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`\"" >> $@; \
- fi; \
- elif [ ! -f $@ ]; then \
- echo "#define ENIGMA2_LAST_CHANGE_DATE \"`date --rfc-3339=date`\"" > $@; \
- echo "#define ENIGMA2_BRANCH \"$(PACKAGE_VERSION)\"" >> $@; \
- fi;
+if HAVE_FAKE_GIT_DIR
+ENIGMA2_COMMIT_DATE = `grep '^CommitDate:' $(GIT_DIR)/last_commit_info | cut -d' ' -f2`
+ENIGMA2_BRANCH = `cat $(GIT_DIR)/branch`
+else
+ENIGMA2_COMMIT_DATE = `$(GIT) log --no-color -n 1 --pretty=format:%cd --date=short`
+ENIGMA2_BRANCH = `$(GIT) branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
+ENIGMA2_REV = `$(GIT) describe --abbrev=7 --always --long --tags`
+endif
+endif