1#!/bin/sh 2 3# Author: Xianjun Jiao 4# SPDX-FileCopyrightText: 2019 UGent 5# SPDX-License-Identifier: AGPL-3.0-or-later 6 7VERSION="3.17" 8OUT="$1" 9 10if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then 11 git update-index --refresh --unmerged > /dev/null 12 descr=$(git describe) 13 14 # on git builds check that the version number above 15 # is correct... 16 [ "${descr%%-*}" = "v$VERSION" ] || exit 2 17 18 v="${descr#v}" 19 if git diff-index --name-only HEAD | read dummy ; then 20 v="$v"-dirty 21 fi 22else 23 v="$VERSION" 24fi 25 26echo '#include "sdrctl.h"' > "$OUT" 27echo "const char sdrctl_version[] = \"$v\";" >> "$OUT" 28