From f851f21131a1aab2d9a9449e47876132c2d948c4 Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Wed, 24 May 2023 13:05:31 +0200 Subject: Update generate_version_h.sh --- generate_version_h.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'generate_version_h.sh') diff --git a/generate_version_h.sh b/generate_version_h.sh index 4ea23c0..a9b39e4 100755 --- a/generate_version_h.sh +++ b/generate_version_h.sh @@ -1,8 +1,23 @@ -#!/bin/sh +#!/bin/bash -VERSION=`git describe --abbrev=0` -HASH=`git show --format="%h" --no-patch master` -BRANCH=`git rev-parse --abbrev-ref HEAD` +if [ -d ".git" ] +then +# If we have a git directory use that as an information source + VERSION=`git describe --abbrev=0` + HASH=`git show --format="%h" --no-patch master` + BRANCH=`git rev-parse --abbrev-ref HEAD` +elif [ "$#" = "3" ] +then +# If we have 3 commandline arguments use them + VERSION="$1" + HASH="$2" + BRANCH="$3" +else +# We don't know our version + VERSION="Unknown" + HASH="none" + BRANCH="Unknown" +fi echo "#ifndef HAVE_VERSION_H" echo "#define HAVE_VERSION_H" -- cgit v1.2.3