echo 'This is a wrapper to Trolltech qmake.'
if 
[ "$1" = '--help' ]
 then
echo 'Available options are as follows:'
echo
echo '--help                (This help screen)'
echo '--prefix={pathname}   (Install BibleMemorizer components under "pathname".'
echo '                      e.g. {pathname}/bin/biblememorizer, etc.  Often "usr"'
echo '                      or "/usr/local" or something similar on Linux/Unix.)'
echo '--sword-path={path}   (Install the optional Sword extensions, and do so in'
echo '                      the path specified by "path".)'
exit 0
fi
SWORDCONFIG=''
SWORDDIR=''
PATHINFO='MAIN_PATH = /usr'
for param
do
case $param in
--prefix=*)
 PATHINFO="MAIN_PATH = ${param:9}"
  ;;
--sword-path=*)
 SWORDCONFIG="CONFIG += sword"
 SWORDDIR="SWORD_PATH = ${param:13}"
  ;;
esac
done
echo 'Script generated options:'
echo $SWORDCONFIG
echo $SWORDDIR
echo $PATHINFO
echo $SWORDCONFIG > qmake_vars
echo $SWORDDIR >> qmake_vars
echo $PATHINFO >>qmake_vars
rm Makefile
rm src/Makefile
rm plugins/Makefile
rm plugins/crosswire/Makefile
rm plugins/lang_en/Makefile
qmake -o Makefile biblememorizer.pro
echo 'qmake finished.'
echo 'It is normal for qmake to take a very short time and not generate output.'
echo 'Go ahead and run 'make' now (though reading INSTALL first is recommended).'
