# Update MM source files from a master directory to a working directory.
# Used for building MM for different platforms on the same common file system.

h=~/mm/work            # source (master) directory (change as needed)
j=/home/fdc/mm/work    # target directory (change as needed)

k=`pwd`
echo
echo "Updating MM source files"

cd $h || exit 1
echo "------------"
echo `pwd`...

cd $h/ccmd || exit 1
echo "------------"
echo `pwd`...

for i in UPDATE *.[cHh] *.cnf *.h4 *.txt copyrite *.awk *.top *.unx *.dos \
*.guide README Makefile; do
  if test $i -nt $j/ccmd/$i ; then
    echo -n $i " => $j/ccmd/$i..."
    cp -p $i $j/ccmd/
    if [ $? -ne 0 ]; then
      echo FAILED
    else
      echo OK
    fi
  fi
done

cd $h/mm || exit 1
echo "------------"
echo `pwd`...

for i in *.[cHh] *.txt *.awk INSTALL *.1 *.el whobuiltme patches Makefile; do
  if test $i -nt $j/mm/$i ; then
    echo -n $i " => $j/mm/$i..."
    cp -p $i $j/mm/
    if [ $? -ne 0 ]; then
      echo FAILED
    else
      echo OK
    fi
  fi
done

cd $h/mm/sysh || exit 1
echo "------------"
echo `pwd`...

for i in *.h; do
  if test $i -nt $j/mm/sysh/$i ; then
    echo -n $i " => $j/mm/sysh/$i..."
    cp -p $i $j/mm/sysh/
    if [ $? -ne 0 ]; then
      echo FAILED
    else
      echo OK
    fi
  fi
done

cd $k
echo "------------"
echo Done
echo
