#!/bin/sh
if [ ! -r $1 ]; then
   echo "No such file $1"
   exit
fi
f=$1
shift
if [ x$1 = x ]; then
   a="-DWIN32 "
else
   a=
   for b in $*; do
    a="$a $b"
    shift
   done
echo Edit string "$a"
echo "sed 's/CFLAGS = /CFLAGS = $a '/" $f '>' tmp$$
fi
exit
cp $f $f-safe
sed 's/CFLAGS = /CFLAGS = '$a' /' $f > tmp$$
mv tmp$$ $f
echo "Makefile $f updated."
fgrep 'CFLAGS = ' $f /dev/null
ls -l $f
echo "If this fails, restore the Makefile from the tar"
echo "Leave out the leading path up to 'seiscomp/' or './'   i.e.:"
ff=`echo $f | sed 's|/home/.*seiscomp/||; s|\./||'`
echo "tar xfv seiscomp-basic-2.6.2009.075.tar $ff"
exit
