# Generate the Vsys toolchain for Hatari.  Assume the standard
# directory tree with this file at usr/GenVsys.s.
#
# Successfully running this script twice guarantees that the build
# builds itself.
#
# Some of the subscripts called below run Vsys commands which pause the
# shell with "Ready" messages upon completion.  Press any key to
# continue.
#
# dnw, 11-Feb-2022

# Build AAma.ttp.
cd ASM
pwd
AA11.s
rm *.y

# Build Link.ttp.
cd ../Load
pwd
L11.s
rm *.y

# Build Das.ttp, Ldo.ttp, and Dis.ab.
cd ../DBG
pwd
Das11.s
Ldo11.s
rm *.y

# Build ved11.ttp.
cd ../ed
pwd
Ved11.s
rm *.y

# Build Schip.yy with IOst.y, test it with Ldo, and build Schip.ttp.
cd ../TSCHIP
pwd
Schip11.s
rm *.y *.yy

# Install in usr/bin and /usr/lib.
cd ..
pwd
mv ASM/AAma.ttp bin
echo "Moved ASM/AAma.ttp to bin."
mv Load/Link.ttp bin
echo "Moved Load/Link.ttp to bin."
mv DBG/Das.ttp bin
echo "Moved DBG/Das.ttp to bin."
mv DBG/Ldo.ttp bin
echo "Moved DBG/Ldo.ttp to bin."
mv DBG/Dis.ab lib
echo "Moved DBG/Dis.ab to lib."
mv ed/ved11.ttp bin/v.ttp
echo "Moved ed/ved11.ttp to bin/v.ttp"
mv TSCHIP/Schip11.ttp bin/Schip.tpp
echo "Moved TSCHIP/Schip11.ttp to bin/Schip.ttp."
