ref: 5b2469c0b5bff8c40a1960b17c920504cb4759bd
parent: 4db34bdf4330d89b4ecdb3b582803f3bc5a519ae
parent: f90cd367d292d85ddb211730df36f3ed157956a5
author: sijchen <sijchen@cisco.com>
date: Thu Dec 18 10:51:07 EST 2014
Merge pull request #1642 from mstorsjo/avoid-rebuilds Avoid rebuilds if the version header hasn't changed
--- a/codec/common/generate_version.sh
+++ b/codec/common/generate_version.sh
@@ -1,5 +1,4 @@
#!/bin/bash
-rm -f codec/common/inc/version.h
git rev-list HEAD | sort > config.git-hash
LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
if [ $LOCALVER \> 1 ] ; then
@@ -15,6 +14,13 @@
GIT_VERSION='"'$GIT_VERSION'"'
rm -f config.git-hash
-cat codec/common/inc/version.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > codec/common/inc/version.h
+cat codec/common/inc/version.h.template | sed "s/\$FULL_VERSION/$GIT_VERSION/g" > codec/common/inc/version.h.new
+if cmp codec/common/inc/version.h.new codec/common/inc/version.h > /dev/null 2>&1; then
+ # Identical to old version, don't touch it (to avoid unnecessary rebuilds)
+ rm codec/common/inc/version.h.new
+ echo "Keeping existing codec/common/inc/version.h"
+ exit 0
+fi
+mv codec/common/inc/version.h.new codec/common/inc/version.h
echo "Generated codec/common/inc/version.h"