crashtest-r0ket/simulat0r/bin/update-bridge-files.sh

60 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
function verbmsg()
{
true
# echo $1
}
if test ! -d simulat0r/firmware -o ! -d firmware
then
echo ERROR:
echo This script must be run from toplevel r0ket directory
exit
fi
echo "Updating directories"
for i in `find firmware -type d `
do
if test -d simulat0r/$i
then verbmsg "OK Directory already exists: $i"
else mkdir -v simulat0r/$i
fi
done
echo "Updating bridge files for C source"
for i in `find firmware \! -path firmware/lcd/allfonts.h \! -path firmware/l0dable/usetable.h -type f -iname \*.[ch]`
do
if test -f simulat0r/$i;
then
verbmsg "OK File already exists: $i"
else
echo Writing bridge file simulat0r/$i
(printf "/* AUTOGENERATED SOURCE FILE */\n"; echo \#include \"`dirname $i | sed "s#[^/]*#..#g" `/../$i\") >simulat0r/$i
fi
done
echo "Updating bridge files for Makefiles"
for i in `find firmware -type f -iname Makefile`
do
if test -f simulat0r/$i;
then
verbmsg "OK File already exists: $i"
else
echo Writing bridge file simulat0r/$i
(printf "# GENERATED INCLUDE BRIDGE/\n"; echo include `dirname $i | sed "s#[^/]*#..#g" `/../$i) >simulat0r/$i
fi
done
for i in `find firmware -type f -name .gitignore`; do
if cmp $i simulat0r/$i
then
echo OK $i and simulat0r/$i are the same
else
echo WARNING: $i mismatches simulat0r/$i
echo " give this command a try if the following diff looks reasonable:"
echo " cp $i simulat0r/$i"
diff -y $i simulat0r/$i || true
fi
done