From: Lyndon Nerenberg Date: Sun, 5 Oct 2014 07:26:11 +0000 (-0700) Subject: If building from a non-master git branch, include the branch name in the version... X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/a65a4bcf635f8be1b35e0cf0c506894a92f62acf?ds=inline;hp=46f35e659f3bc3e808a70263bea0ec72624c8a08 If building from a non-master git branch, include the branch name in the version string. --- diff --git a/Makefile.am b/Makefile.am index 7ffcf9b0..37139200 100644 --- a/Makefile.am +++ b/Makefile.am @@ -478,8 +478,8 @@ etc_gen_ctype_checked_LDADD = $(POSTLINK) ## Hard-code the config/version.c target, instead of using $@, so this ## rule works for the distcheck target with Solaris (System V) make. ## distcheck uses VPATH, causes that make to prepend the VPATH to $@. -config/version.c: Makefile - sh $(srcdir)/config/version.sh $(VERSION) > ./config/version.c +config/version.c: Makefile config/version.sh + env srcdir="$(srcdir)" sh $(srcdir)/config/version.sh $(VERSION) > ./config/version.c sbr/sigmsg.h: $(srcdir)/sbr/sigmsg.awk $(SIGNAL_H) $(AWK) -f $(srcdir)/sbr/sigmsg.awk $(SIGNAL_H) > $@ diff --git a/config/version.sh b/config/version.sh index 1ff7eed4..bf95447d 100755 --- a/config/version.sh +++ b/config/version.sh @@ -38,5 +38,12 @@ done IFS=" " -echo "char *version_str = \"nmh-$VERSION [compiled on $HOSTNAME at `date`]\";" +if [ -d "${srcdir}/.git" ] ; then + branch=`(git branch | grep '^\*' | tr -d '* ') || true` +fi +if [ "${branch}" -a "${branch}" != "master" ] ; then + echo "char *version_str = \"nmh-$VERSION [branch ${branch}] [compiled on $HOSTNAME at `date`]\";" +else + echo "char *version_str = \"nmh-$VERSION [compiled on $HOSTNAME at `date`]\";" +fi echo "char *version_num = \"nmh-$VERSION\";"