perf tests: Move test__syscall_open_tp_fields into separate object
[linux-2.6.git] / tools / perf / util / PERF-VERSION-GEN
blob6aa34e5afdcfc0a57cafc12d6bc631d2d8169fbb
1 #!/bin/sh
3 if [ $# -eq 1 ] ; then
4 OUTPUT=$1
5 fi
7 GVF=${OUTPUT}PERF-VERSION-FILE
9 LF='
13 # First check if there is a .git to get the version from git describe
14 # otherwise try to get the version from the kernel Makefile
16 if test -d ../../.git -o -f ../../.git &&
17 VN=$(git tag 2>/dev/null | tail -1 | grep -E "v[0-9].[0-9]*")
18 then
19 VN=$(echo $VN"-g"$(git log -1 --abbrev=4 --pretty=format:"%h" HEAD))
20 VN=$(echo "$VN" | sed -e 's/-/./g');
21 else
22 VN=$(MAKEFLAGS= make -sC ../.. kernelversion)
25 VN=$(expr "$VN" : v*'\(.*\)')
27 if test -r $GVF
28 then
29 VC=$(sed -e 's/^PERF_VERSION = //' <$GVF)
30 else
31 VC=unset
33 test "$VN" = "$VC" || {
34 echo >&2 "PERF_VERSION = $VN"
35 echo "PERF_VERSION = $VN" >$GVF