1bff2167b5173f86bb9ef66b211101e4b8cd7889
[rapper.git] / tools / lpcrc / lpcrc.sh
1 #!/bin/sh
2
3 binary=$1
4 source=$2
5
6 lpcrc=$(dirname $(readlink -f $0))/lpcrc
7
8 crcoutput=$($lpcrc $1)
9
10 echo "$crcoutput" | grep -q differs
11 if [ $? -eq 0 ] ; then
12         crc=$(echo "$crcoutput" | grep new_crc | cut -d' ' -f2)
13         sed -i -e \
14           's/^\(#define CRC_CHECKSUM 0x\)[a-f0-9]\{8\}$/\1'$crc'/g' \
15           $source
16         make crc
17 fi