3 if [ ! -f version.sh ] && [ ! -d .git ]
5 echo Your copy of unifdef is incomplete 1>&2
9 [ -f version.sh ] && . ./version.sh
13 GV=$(git describe | sed 's|-g*|.|g;s|[.]|-|')
14 git update-index -q --refresh
15 if git diff-index --quiet HEAD
17 GD="$(git show --pretty=format:%ai -s HEAD)"
19 GD="$(date +'%Y-%m-%d %H:%M:%S %z')"
22 [ unifdef -nt unifdef.c ] &&
23 [ unifdef -nt unifdef.h ] &&
25 if [ "$GV $GD" != "$V $D" ]
27 echo "version $V $D" 1>&2
28 echo " -> $GV $GD" 1>&2
31 echo "V=\"$V\"" >version.sh
32 echo "D=\"$D\"" >>version.sh
39 printf '"@(#) $Version: %s $\\n"\n' "$V" >version.h
40 printf '"@(#) $Date: %s $\\n"\n' "$D" >>version.h