]> git.ipfire.org Git - thirdparty/iw.git/blobdiff - version.sh
iw: Add OCB mode handling
[thirdparty/iw.git] / version.sh
index 938a65d0ac3a51493e656104ebb77434a32566d4..82af11e13b566b23f78e21aca2115af285bc35a0 100755 (executable)
@@ -1,22 +1,23 @@
 #!/bin/sh
 
-VERSION="0.9.6"
-OUT="version.h"
+VERSION="3.17"
+OUT="$1"
 
-if head=`git rev-parse --verify HEAD 2>/dev/null`; then
+if [ -d .git ] && head=`git rev-parse --verify HEAD 2>/dev/null`; then
        git update-index --refresh --unmerged > /dev/null
        descr=$(git describe)
 
        # on git builds check that the version number above
        # is correct...
        [ "${descr%%-*}" = "v$VERSION" ] || exit 2
-       
-       echo -n '#define IW_VERSION "' > "$OUT"
-       echo -n "${descr#v}" >> "$OUT"
+
+       v="${descr#v}"
        if git diff-index --name-only HEAD | read dummy ; then
-               echo -n "-dirty" >> "$OUT"
+               v="$v"-dirty
        fi
-       echo '"' >> "$OUT"
 else
-echo "#define IW_VERSION \"$VERSION-nogit\"" > "$OUT"
+       v="$VERSION"
 fi
+
+echo '#include "iw.h"' > "$OUT"
+echo "const char iw_version[] = \"$v\";" >> "$OUT"