build systems: uniformize git_sha1.h generation
[mesa.git] / git_sha1_gen.sh
1 #!/bin/sh
2
3 # run git from the sources directory
4 cd "$(dirname "$0")"
5
6 # don't print anything if git fails
7 if ! git_sha1=$(git --git-dir=.git rev-parse --short=10 HEAD 2>/dev/null)
8 then
9 exit
10 fi
11
12 printf '#define MESA_GIT_SHA1 "git-%s"\n' "$git_sha1"