xref: /freebsd/contrib/ntp/scripts/build/mkver.in (revision d8a0fe102c0cfdfcd5b818f850eff09d8536c9bc)
1#!@CONFIG_SHELL@
2PROG=${1-UNKNOWN}
3
4ConfStr="$PROG"
5
6ConfStr="$ConfStr @VERSION@"
7
8case "$CSET" in
9 '') ;;
10 *) ConfStr="$ConfStr@$CSET" ;;
11esac
12
13case "@VER_SUFFIX@" in
14 '') ;;
15 *) ConfStr="${ConfStr}-@VER_SUFFIX@" ;;
16esac
17
18ConfStr="$ConfStr `LC_TIME=C TZ=UTC date`"
19
20if [ ! -f .version ]; then
21  echo 0 > .version
22fi
23RUN="`cat .version`"
24RUN="`expr $RUN + 1`"
25echo $RUN > .version
26
27ConfStr="$ConfStr (${RUN})"
28
29echo "Version <${ConfStr}>";
30
31rm -f version.c
32cat > version.c << -EoF-
33/*
34 * version file for $PROG
35 */
36#include <config.h>
37const char * Version = "${ConfStr}";
38-EoF-
39