#!/bin/sh
SCRIPT=$1

case "$SCRIPT" in
     A5-HARDFLOAT | a5-hardfloat | A5-HardFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' mstconfigure_muf.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.32.15\/kernel\"/g' mstconfigure_muf.sh;
         sed -i 's/CHIP=.*/CHIP=a5/g' mstconfigure_muf.sh;
         sed -i 's/--enable-debug/--disable-debug/g' mstconfigure_muf.sh;
         ;;
     A5-SOFTFLOAT | a5-softfloat | A5-SoftFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' mstconfigure_muf.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.32.15\/kernel\"/g' mstconfigure_muf.sh;
         sed -i 's/CHIP=.*/CHIP=a5/g' mstconfigure_muf.sh;
         sed -i 's/--enable-debug/--disable-debug/g' mstconfigure_muf.sh;
         sed -i 's/CFLAGS_SETTING="-EL.*/CFLAGS_SETTING="-EL -msoft-float -pthread -I$DFB_NEEDED_PATH\/png -I$DFB_NEEDED_PATH\/zlib -I$DFB_NEEDED_PATH\/jpeg -I$DFB_NEEDED_PATH\/freetype\/freetype2 -I$DFB_NEEDED_PATH\/freetype -I$UTOPIA_INCLUDE_PATH -I$KERNEL_PATH\/include -I$KERNEL_PATH\/usr\/include -I$KERNEL_PATH\/drivers\/mstar\/include -I$KERNEL_PATH\/arch\/mips\/include -DMSOS_TYPE_LINUX  -DPAGESIZE_LOG=12"/g' mstconfigure_muf.sh;
         sed -i 's/CPPFLAGS_SETTING="-EL.*/CPPFLAGS_SETTING="-EL -pthread -msoft-float"/g' mstconfigure_muf.sh;
         ;;
     A3-HARDFLOAT | a3-hardfloat | A3-HardFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.35.8\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CHIP=.*/CHIP=a3/g' Arm_mstconfigure_muf.sh;
         sed -i 's/--enable-debug/--disable-debug/g' Arm_mstconfigure_muf.sh;
         ;;
     A3-SOFTFLOAT | a3-softfloat | A3-SoftFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.35.8\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CHIP=.*/CHIP=a3/g' Arm_mstconfigure_muf.sh;
         sed -i 's/--enable-debug/--disable-debug/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian.*/CFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian  -march=armv7-a -mcpu=cortex-a9 -mfpu=neon  -mfloat-abi=soft -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -fno-strict-aliasing -fno-optimize-sibling-calls -fno-exceptions -ffunction-sections -fdata-sections -O2 -pthread -I$DFB_NEEDED_PATH\/png -I$DFB_NEEDED_PATH\/zlib -I$DFB_NEEDED_PATH\/jpeg -I$DFB_NEEDED_PATH\/freetype\/freetype2 -I$DFB_NEEDED_PATH\/freetype -I$UTOPIA_INCLUDE_PATH -I$KERNEL_PATH\/include -I$KERNEL_PATH\/usr\/include -I$KERNEL_PATH\/drivers\/mstar\/include -I$KERNEL_PATH\/arch\/arm\/include -I$THEALE_PATH\/RedLion\/Lunar\/directfb\/1.4.2\/ -DMSOS_TYPE_LINUX"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CPPFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian.*/CPPFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian  -march=armv7-a -mcpu=cortex-a9 -mfpu=neon  -mfloat-abi=soft -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -fno-strict-aliasing -fno-optimize-sibling-calls -fno-exceptions -ffunction-sections -fdata-sections -O2 -pthread "/g' Arm_mstconfigure_muf.sh;
         ;;
     EIFFEL-HARDFLOAT | eiffel-hardfloat | Eiffel-HardFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.35.8\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CHIP=.*/CHIP=eiffel/g' Arm_mstconfigure_muf.sh;
         sed -i 's/--enable-debug/--disable-debug/g' Arm_mstconfigure_muf.sh;
         ;;
     EIFFEL-SOFTFLOAT | eiffel-softfloat | Eiffel-SoftFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.35.8\"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CHIP=.*/CHIP=eiffel/g' Arm_mstconfigure_muf.sh;
         sed -i 's/--enable-debug/--disable-debug/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian.*/CFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian  -march=armv7-a -mcpu=cortex-a9 -mfpu=neon  -mfloat-abi=soft -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -fno-strict-aliasing -fno-optimize-sibling-calls -fno-exceptions -ffunction-sections -fdata-sections -O2 -pthread -I$DFB_NEEDED_PATH\/png -I$DFB_NEEDED_PATH\/zlib -I$DFB_NEEDED_PATH\/jpeg -I$DFB_NEEDED_PATH\/freetype\/freetype2 -I$DFB_NEEDED_PATH\/freetype -I$UTOPIA_INCLUDE_PATH -I$KERNEL_PATH\/include -I$KERNEL_PATH\/usr\/include -I$KERNEL_PATH\/drivers\/mstar\/include -I$KERNEL_PATH\/arch\/arm\/include -I$THEALE_PATH\/RedLion\/Lunar\/directfb\/1.4.2\/ -DMSOS_TYPE_LINUX"/g' Arm_mstconfigure_muf.sh;
         sed -i 's/CPPFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian.*/CPPFLAGS_SETTING=" -DMSOS_PROCESS_SAFT_MUTEX -mlittle-endian  -march=armv7-a -mcpu=cortex-a9 -mfpu=neon  -mfloat-abi=soft -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -fno-strict-aliasing -fno-optimize-sibling-calls -fno-exceptions -ffunction-sections -fdata-sections -O2 -pthread "/g' Arm_mstconfigure_muf.sh;
         ;;
     A7P-HARDFLOAT | a7p-hardfloat | A7p-HardFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/#PHOTOSPHERE\_ROOT=.*/PHOTOSPHERE\_ROOT=\"$THEALE\_PATH\/..\/DAILEO\/Supernova\"/g' mstconfigure_muf_uclibc.sh;
         sed -i 's/KERNEL\_PATH=.*/KERNEL\_PATH=\"\$THEALE\_PATH\/RedLion\/2.6.32.15\/kernel\"/g' mstconfigure_muf_uclibc.sh;
         sed -i 's/CHIP=.*/CHIP=amethyst.lite/g' mstconfigure_muf_uclibc.sh;
         sed -i 's/--enable-debug/--disable-debug/g' mstconfigure_muf_uclibc.sh;
         ;;
     K3-HARDFLOAT | k3-hardfloat | K3-HardFloat)
         export THEALE_PATH=$(pwd)/../../../..;
         echo THEALE_PATH : $THEALE_PATH;
         sed -i 's/--enable-debug/--disable-debug/g' mstconfigure_ddi_arm.sh;
         ;;
     *)
     
         echo ##### modify configure_muf.sh
         #exit 1
         ;;
esac
