#!/bin/sh

#
# Modification History
#
# 2004-June-10    Jason Rohrer
# Copied/modified from Monolith project.
#
# 2004-August-25    Jason Rohrer
# Added support for editors directory.
#


while [ -z "$platformSelection" ]
do
    echo "select platform:"

    echo "  1 --  GNU/Linux X86"
    echo "  2 --  GNU/Linux PPC"
    echo "  3 --  FreeBSD X86"
    echo "  4 --  MacOSX"
    echo "  5 --  Solaris"
    echo "  6 --  Win32 using MinGW"
    echo "  q --  quit"

    echo ""
    echo -n "> "

    read platformSelection

	
	if [ "$platformSelection" = "q" ]
    then
        exit
    fi


    # use ASCII comparison.

	if [[ "$platformSelection" > "6" ]]
    then
        platformSelection=""
    fi

    if [[ "$platformSelection" < "1" ]]
    then
        platformSelection=""
    fi

done




platformName="Generic"
platformMakefile="generic"



case "$platformSelection" in


    "1" )
        platformName="GNU/Linux X86"
        platformMakefile="Makefile.GnuLinuxX86"
    ;;


    "2" )
        platformName="GNU/Linux PPC"
        platformMakefile="Makefile.GnuLinuxPPC"
    ;;


    "3" )
        platformName="FreeBSD X86"
        platformMakefile="Makefile.FreeBSDX86"
    ;;


    "4" )
        platformName="MacOSX"
        platformMakefile="Makefile.MacOSX"
    ;;


    "5" )
        platformName="Solaris"
        platformMakefile="Makefile.Solaris"
    ;;


    "6" )
        platformName="Win32 MinGW"
        platformMakefile="Makefile.MinGW"
    ;;


esac



rm -f Makefile.temp
echo "# Auto-generated by Transcend/configure for the $platformName platform.  Do not edit manually." > Makefile.temp

rm -f game/Makefile
cat Makefile.temp $platformMakefile Makefile.common Makefile.minorGems game/Makefile.all Makefile.minorGems_targets > game/Makefile

rm -f editors/Makefile
cat Makefile.temp $platformMakefile Makefile.common Makefile.minorGems editors/Makefile.all Makefile.minorGems_targets > editors/Makefile

rm Makefile.temp



exit
