summaryrefslogtreecommitdiffstats
path: root/version.sh
diff options
context:
space:
mode:
Diffstat (limited to 'version.sh')
-rwxr-xr-xversion.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/version.sh b/version.sh
index 3eac7ef050..a3d753da44 100755
--- a/version.sh
+++ b/version.sh
@@ -2,16 +2,22 @@
export LC_ALL=C
+version_h="version.h"
+
for ac_option do
+ ac_arg=$(echo $ac_option | cut -d '=' -f 2-)
case "$ac_option" in
--extra=*)
- extra="-$option"
+ extra="-$ac_arg"
+ ;;
+ --versionh=*)
+ version_h="$ac_arg"
;;
--print)
print=yes
;;
*)
- echo "Unknown parameter: $option" >&2
+ echo "Unknown parameter: $ac_option" >&2
exit 1
;;
@@ -42,12 +48,12 @@ if test "$print" = yes ; then
fi
NEW_REVISION="#define VERSION \"${VERSION}\""
-OLD_REVISION=$(head -n 1 version.h 2> /dev/null)
+OLD_REVISION=$(head -n 1 "$version_h" 2> /dev/null)
BUILDDATE="#define BUILDDATE \"$(date)\""
# Update version.h only on revision changes to avoid spurious rebuilds
if test "$NEW_REVISION" != "$OLD_REVISION"; then
- cat <<EOF > version.h
+ cat <<EOF > "$version_h"
$NEW_REVISION
$BUILDDATE
EOF