summaryrefslogtreecommitdiff
path: root/firmware/scripts/mkcompile_h
blob: 22ac262fe6ffdbe860c8581d199273fe0413f9a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

MAX_LEN=32
TRUNCATE="sed -e s/\(.\{1,$MAX_LEN\}\).*/\1/"

DATE=`LC_ALL=C LANG=C date +%Y%m%d-%H%M%S`
BY=`whoami`
HOST=`hostname | $TRUNCATE`
BYHOST=`echo ${BY}@${HOST} | $TRUNCATE`
SVNREV=`svn info | grep \^Revision: | cut -c 11-`

svn st | grep \^M >/dev/null

[ "$?" -eq "0" ] && SVNREV=${SVNREV}-unclean

echo "#ifndef _COMPILE_H"
echo "#define _COMPILE_H"
echo
echo /\* This file is auto generated \*/
echo \#define COMPILE_DATE \"${DATE}\"
echo \#define COMPILE_BY \"${BYHOST}\"
echo \#define COMPILE_SVNREV \"${SVNREV}\"
echo
echo "#endif /* _COMPILE_H */"
personal git repositories of Harald Welte. Your mileage may vary