xref: /aosp_15_r20/external/ltp/lib/gen_version.sh (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#!/bin/sh
2*49cdfc7eSAndroid Build Coastguard Worker
3*49cdfc7eSAndroid Build Coastguard Workertouch cached-version
4*49cdfc7eSAndroid Build Coastguard Worker
5*49cdfc7eSAndroid Build Coastguard Workerif git describe >/dev/null 2>&1; then
6*49cdfc7eSAndroid Build Coastguard Worker	VERSION=`git describe`
7*49cdfc7eSAndroid Build Coastguard Workerelse
8*49cdfc7eSAndroid Build Coastguard Worker	VERSION=`cat $(dirname $0)/../VERSION`
9*49cdfc7eSAndroid Build Coastguard Workerfi
10*49cdfc7eSAndroid Build Coastguard Worker
11*49cdfc7eSAndroid Build Coastguard WorkerCACHED_VERSION=`cat cached-version`
12*49cdfc7eSAndroid Build Coastguard Worker
13*49cdfc7eSAndroid Build Coastguard Workerif [ "$CACHED_VERSION" != "$VERSION" ]; then
14*49cdfc7eSAndroid Build Coastguard Worker	echo "$VERSION" > cached-version
15*49cdfc7eSAndroid Build Coastguard Worker	echo "#define LTP_VERSION \"$VERSION\"" > ltp-version.h
16*49cdfc7eSAndroid Build Coastguard Workerfi
17