#!/bin/bash
#script which automates some standard things when porting mame-dos

#clean up a bit
rm -fR allegro.h allegro seal cfg hi inp obj pcx sta roms samples images artwork ym2203.opm mame.zif *.ZIP *.zip *.dif *.diff
if [ -d src/mess/dir_list ]; then
   mv src/mess/dir_list/crc .
   rm -fR src/mess/dir_list
fi

#create doc dir and unixy
mkdir doc
mv readme.txt doc/readme.mame
mv whatsnew.txt doc/changes.mame
# mv gamelist.txt doc/gamelist.mame # no more since 0.36final
if [ -f whatsold.txt ]; then
  mv whatsold.txt doc/old-changes.mame
fi
if [ -f mess.txt ]; then
  mv mess.txt doc/readme.mess
fi
if [ -f src/mess/docs/messnew.txt ]; then
  mv src/mess/docs/messnew.txt doc/changes.mess
fi
cd doc
d2u *
rm -f *.orig *~
cd ..

#fix comments & includes
cd src
fix-comments `find -name "*.c"`
fix-comments `find -name "*.h"`
d2u `find -name "*.txt"`
d2u `find -name "*.mak"`
rm -f `find -name "*.orig"`
rm -f `find -name "*.txt~"`
cd ..

#mv makefile makefile.mame and unixy
mv makefile makefile.mame
d2u makefile.*
rm -f makefile.*.orig makefile.*~
