#!/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
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 longer seems to exist
if [ -d src/mess/docs ]; then
  mv src/mess/docs/mess.txt doc/readme.mess
  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"`
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.*~
