#!/bin/sh

. common.sh

if [ "$1" = "" ]
then
  echo "Usage:  ./buildkernel <synth ID>"
  exit 1
fi

cd ${KERNEL_ROOT}
cp ${ZIPSPEAK_STAGE_ROOT}/boot/config arch/i386/defconfig
echo "CONFIG_SPEAKUP=y\\" > speakupconfig
for synth in `cat ${ZIPSPEAK_SYNTH_FILE}`
do
  if [ "${synth}" = "$1" ]
  then
    echo "CONFIG_SPEAKUP_${synth}=y\\" >> speakupconfig
  else
    echo "# CONFIG_SPEAKUP_${synth} is not set\\" >> speakupconfig
  fi
done
ed arch/i386/defconfig >/dev/null 2>&1 <<END
g/CONFIG_FONT_ACORN_8x8/a\\
`cat speakupconfig`
.
wq
END
rm speakupconfig
make mrproper
make oldconfig
make dep
make clean
make bzImage
rootflags arch/i386/boot/bzImage 0
cp arch/i386/boot/bzImage ${ZIPSPEAK_DIST_DIR}/`echo $1 | tr A-Z a-z`
