diff options
Diffstat (limited to 'tools/gen-buildcfg.sh')
-rwxr-xr-x | tools/gen-buildcfg.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/gen-buildcfg.sh b/tools/gen-buildcfg.sh new file mode 100755 index 0000000..a09cb20 --- /dev/null +++ b/tools/gen-buildcfg.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +if [[ "" == "$2" ]] +then + echo "Usage: $0 <in-file> <out-file>" + exit 1 +fi + +if [ ! -f "$1" ] +then + echo "Error: Can't find input file $1..." + exit 2 +fi + +DATE=`/usr/bin/env date` +BASE=`basename $2` +BASE=`echo ${BASE} | tr "[:lower:]" "[:upper:]"` +BASE=`echo ${BASE} | sed -e "s/\\./_/"` +PROTECT="_${BASE}" + +echo "/* Auto-generated from $1 on ${DATE} */" > $2 +echo "#ifndef ${PROTECT}" >> $2 +echo "#define ${PROTECT}" >> $2 +sed -e '/^#/d' -e '/^$$/d' -e '/# Makefile only$$/d' -e 's/^/#define /' -e 's/=/ /' $1 >> $2 +echo "#endif" >> $2 + |