summaryrefslogtreecommitdiff
path: root/openpicc/scripts/mkcompile_h
diff options
context:
space:
mode:
authorhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-19 01:59:29 +0000
committerhenryk <henryk@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2007-11-19 01:59:29 +0000
commit18cd5f225b6eb3d4c4a28e39ff20038a63355c84 (patch)
tree5ff833cba304021e29984ea94df35d93b5c726e4 /openpicc/scripts/mkcompile_h
parentc63871ac816955469c7178eed3467de52d4c05e7 (diff)
Add script to generate compile.h
git-svn-id: https://svn.openpcd.org:2342/trunk@331 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'openpicc/scripts/mkcompile_h')
-rwxr-xr-xopenpicc/scripts/mkcompile_h24
1 files changed, 24 insertions, 0 deletions
diff --git a/openpicc/scripts/mkcompile_h b/openpicc/scripts/mkcompile_h
new file mode 100755
index 0000000..22ac262
--- /dev/null
+++ b/openpicc/scripts/mkcompile_h
@@ -0,0 +1,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