#!/bin/sh

OSPLAT=`uname -s`

case "$OSPLAT" in
	"Linux")
		FOOBAROSPLAT=linux
		if test -f "/etc/SuSE-release" ; then
			DIST=SLES
			FOOBARDIST=sles
			DISTVER=`grep VERSION /etc/SuSE-release | sed 's/ //g' | cut -d "=" -f2`
			OSVER=${DIST}${DISTVER}
			FOOBAROSVER=${FOOBARDIST}${DISTVER}
		elif test -f "/etc/redhat-release" ; then
			DIST=RHEL
			FOOBARDIST=rhel
			DISTVER=`head -n 1 /etc/redhat-release | sed 's/^.* release //' | cut -d " " -f1`
			DISTVER=`echo $DISTVER | cut -d "." -f1`
			OSVER=${DIST}${DISTVER}`echo 0`
			FOOBAROSVER=${FOOBARDIST}${DISTVER}`echo 0`
		else
			echo "Linux distribution not known"
			OSPLAT=
			OSVER=
			DIST=default
			FOOBARDIST=default
			DISTVER=6.0
			OSVER=${DIST}${DISTVER}
			FOOBAROSVER=${FOOBARDIST}${DISTVER}
		fi
		OSARCH=`uname -m`
		PLATDIR=$FOOBAROSPLAT/$FOOBAROSVER/$OSARCH
		;;
		*)
		exit 1
		;;
esac

if test $# -gt 0; then
	BUILD_DIR=$1
else
	BUILD_DIR=$SOURCE_ROOT

	if test -z "$BUILD_DIR"; then
		echo "Environment variable SOURCE_ROOT not set/exported and no directory specified on command-line"
	fi
fi

if test -n "$BUILD_DIR" ; then
	SRC_BUILD_DIR=$BUILD_DIR/my_proj

	export SRC_BUILD_DIR
fi

