]> diplodocus.org Git - nmh/commitdiff
If building from a non-master git branch, include the branch name in the version...
authorLyndon Nerenberg <lyndon@orthanc.ca>
Sun, 5 Oct 2014 07:26:11 +0000 (00:26 -0700)
committerLyndon Nerenberg <lyndon@orthanc.ca>
Sun, 5 Oct 2014 07:41:51 +0000 (00:41 -0700)
Makefile.am
config/version.sh

index 7ffcf9b00e9c4275fc732355d32cc32f71b46316..37139200a6b5c086c9099ec0092fafbc6d17d405 100644 (file)
@@ -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) > $@
index 1ff7eed4c11517450a69a00160329eb7b41a4aed..bf95447d6971eb771057bc7ba2f940b936c00fc7 100755 (executable)
@@ -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\";"