blob: 5098d8ad5c6fb59e0b7e52d3bd6f98b5c9e19142 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/bin/sh
if [ ! -f version.sh ] && [ ! -d .git ]
then
echo Your copy of unifdef is incomplete 1>&2
exit 1
fi
[ -f version.sh ] && . ./version.sh
if [ -d .git ]
then
GV=$(git describe | sed 's|-g*|.|g;s|[.]|-|')
git update-index -q --refresh
if git diff-index --quiet HEAD
then
GD="$(git show --pretty=format:%ai -s HEAD)"
else
GD="$(date +'%Y-%m-%d %H:%M:%S %z')"
GV=$GV.XX
fi
[ unifdef -nt unifdef.c ] &&
[ unifdef -nt unifdef.h ] &&
GD="$D"
if [ "$GV $GD" != "$V $D" ]
then
echo "version $V $D" 1>&2
echo " -> $GV $GD" 1>&2
V="$GV"
D="$GD"
echo "V=\"$V\"" >version.sh
echo "D=\"$D\"" >>version.sh
rm -f version.h
fi
fi
if [ ! -f version.h ]
then
printf '"@(#) $Version: %s $\\n"\n' "$V" >version.h
printf '"@(#) $Date: %s $\\n"\n' "$D" >>version.h
fi
|