#!/bin/bash

function UsageAndDie ()
{

	echo "Usage : $0 [options]"
	echo "Options:" 
	echo "        --libdir          # directory where Sagem Mips-Linux SDK is installed" 
	echo "        --includedir      # directory where Sagem Mips-Linux SDK headers are installed" 
	echo "        --kinclude        # Show where cross kernel includes are stored (basedir)"
	echo "        --version         # complete Sagem Mips-Linux SDK version string" 
	echo "        --ldflags         # options required for linking against Sagem Mips-Linux SDK" 
	echo "        --cflags          # options required for compiling Sagem Mips-Linux SDK apps" 
	echo "        --kcflags         # options requied for compiling a kernel module"
	echo "        --cxxflags        # options required for compiling Sagem Mips-Linux SDK apps (c++)" 
	echo "        --kcxxflags       # options requied for compiling a kernel module (c++)"
	echo "        --cc              # print the name of the C compiler"
	echo "        --CC              # print the name of the C++ compiler"
	echo "        --ld              # print the name of the linker (ld)"
	echo "        --as              # print the name of the assembler (as)"
	echo "        --help            # display this message and exit"
	echo "This script is provided for convinience, but may or may not be usefull in you're case"
	echo " WARNING : please don't link it, it would not find it's own directory"
	
	exit 0
}

basedir=$(dirname $0)
basedir=$(dirname $basedir)

if [ -z "$1" ] ; then
	UsageAndDie
fi

while [ -n "$1" ] ; do
	case $1 in
		--cc)
			echo "mips-linux-uclibc-gcc"
		;;
		--ld)
			echo "mips-linux-uclibc-ld"
		;;
		--CC|--cxx)
			echo "mips-linux-uclibc-g++"
		;;
		--as)
			echo "mips-linux-uclibc-as"
		;;	
		--libdir)
			echo "$basedir/"
		;;
		--includedir)
			echo "$basedir/include $basedir/lib/gcc/mips-linux-uclibc/3.4.3/include"
		;;
		--kinclude)
			echo "${basedir}/kernel_include"
		;;
		--version)
			echo "Linux-2.6 V1.1"
		;;
		--ldflags)
#			echo "-L$basedir/lib -L${basedir}/lib/gcc/mips-linux-uclibc/3.4.3 " 
		;;
		--cflags)
#			echo "-nostdinc   -B${basedir} -I$basedir/kernel_include -I$basedir/lib/gcc/mips-linux-uclibc/3.4.3/include"
		;;
		--kcflags)
#			echo "-nostdinc   -B${basedir} -I$basedir/kernel_include -I$basedir/lib/gcc/mips-linux-uclibc/3.4.3/include"
		;;
		--kcxxflags)
#			echo "-nostdinc++ -B${basedir} -I$basedir/kernel_include -I$basedir/lib/gcc/mips-linux-uclibc/3.4.3/include"
		;;
		--cxxflags)
#			echo "-nostdinc++ -B${basedir} -I$basedir/kernel_include -I$basedir/lib/gcc/mips-linux-uclibc/3.4.3/include"
		;;
		--help)
			UsageAndDie
		;;
		*)
			UsageAndDie
		;;	

	esac
	shift
	
done

