]> git.itanic.dy.fi Git - log-plotter/blob - mkcompile_h
Add primitive config file parsing support
[log-plotter] / mkcompile_h
1 #!/bin/sh
2
3 VERSION_TMP=.version
4 VERSION_TARGET=version.h
5
6 VERSION_STR=$(git show | grep ^commit | sed -e s.commit\ .. | cut -b -10)
7
8 COMPILER_STR="$1"
9 COMPILER_STR_TARGET=.compiler_check
10 COMPILER_STR_TMP=$COMPILER_CHECK.tmp
11
12 echo > $VERSION_TMP
13 echo "#ifndef _VERSION_H_" >> $VERSION_TMP
14 echo "#define _VERSION_H_" >> $VERSION_TMP
15 echo >> $VERSION_TMP
16 echo "/* Autogenerated version.h file */" >> $VERSION_TMP
17 echo >> $VERSION_TMP
18 echo "#define LOG-PLOTTER_VERSION \"$VERSION_STR\"" >> $VERSION_TMP
19 echo >> $VERSION_TMP
20 echo "#endif" >> $VERSION_TMP
21
22 if [ -f $VERSION_TARGET ] ; then
23         cmp -s $VERSION_TMP $VERSION_TARGET || cp $VERSION_TMP $VERSION_TARGET
24 else
25         cp $VERSION_TMP $VERSION_TARGET
26 fi
27
28 echo $COMPILER_STR > $COMPILER_STR_TMP
29
30 if [ -f $COMPILER_STR_TARGET ] ; then
31         cmp -s $COMPILER_STR_TMP $COMPILER_STR_TARGET || \
32             cp $COMPILER_STR_TMP $COMPILER_STR_TARGET
33 else
34         cp $COMPILER_STR_TMP $COMPILER_STR_TARGET
35 fi
36