#!/bin/sh
# --------------------------------
# building ttstart
# --------------------------------
echo building ttstart ...
cd ttstart
./build
cd ..
cp ttstart*.89z ../../bin89
cp ttstart*.9xz ttstart*.v2z ../../bin92p
rm -f ttstart*.??z

# --------------------------------
# building pstarter.o
# --------------------------------
#echo building pstarter.o ...
#cd pstarter
#./build
#cd ..
#cp pstarter.o ../../tigcc_patch
#rm -f pstarter.o

# --------------------------------
# building ttmem
# --------------------------------
echo building ttmem ...
tigcc -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections ttmem.c
cp ttmem.89z ../../bin89
cp ttmem.9xz ttmem.v2z ../../bin92p
rm -f ttmem.??z

# --------------------------------
# building tthedit
# --------------------------------
echo building tthedit ...
tigcc -Os -DUSE_TI89 -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections tthedit.c
cp tthedit.89z ../../bin89

tigcc -Os -DUSE_TI92P -DUSE_V200 -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections tthedit.c
cp tthedit.9xz tthedit.v2z ../../bin92p
rm -f tthedit.??z

# --------------------------------
# building tthw
# --------------------------------
echo building tthw ...
tigcc -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections tthw.c
cp tthw.89z ../../bin89
cp tthw.9xz tthw.v2z ../../bin92p
rm -f tthw.??z

# --------------------------------
# building ebook
# --------------------------------
echo building ebook ...
cd ebook
./build
cd ..
cp ebook*.89z ../../bin89
cp ebook*.9xz ebook*.v2z ../../bin92p
rm -f ebook*.??z

# --------------------------------
# building tthdex
# --------------------------------
# 1.40: removed from the process by intention. Read the history for more information.
#echo building tthdex ...
#tigcc -DUSE_TI89 -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections tthdex.c
#cp tthdex.89z ../../bin89
#rm -f tthdex.89z
#tigcc -DUSE_TI89 -DNO_HELP -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections -o tthdexm tthdex.c
#cp tthdexm.89z ../../bin89
#rm -f tthdexm.89z

#tigcc -DUSE_TI92P -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections tthdex.c
#cp tthdex.9xz ../../bin92p
#rm -f tthdex.9xz
#tigcc -DUSE_TI92P -DNO_HELP -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections -o tthdexm tthdex.c
#cp tthdexm.9xz ../../bin92p
#rm -f tthdexm.9xz

# --------------------------------
# building ttbatt
# --------------------------------
echo building ttbatt ...
tigcc -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections ttbatt.c
cp ttbatt.89z ../../bin89
cp ttbatt.9xz ttbatt.v2z ../../bin92p
rm -f ttbatt.??z

# --------------------------------
# building ttrow
# --------------------------------
echo building ttrow ...
tigcc -DUSE_TI89 -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections ttrow.c
cp ttrow.89z ../../bin89
tigcc -DUSE_TI92PLUS -DUSE_V200 -Os -Wall -W -Wwrite-strings -fomit-frame-pointer -mpcrel -mregparm=5 -ffunction-sections -fdata-sections --merge-constants -fmerge-all-constants --optimize-code --cut-ranges --reorder-sections ttrow.c
cp ttrow.9xz ttrow.v2z ../../bin92p
rm -f ttrow.??z
