#Prerequisite: SPLICE_TARGET must be set!
#This is the main script to select components for a certain platform
#

. "${OSPL_HOME}/setup/configuration/setup_all"

if [ -n "$OSPL_OUTER_HOME" ]
then
. "${OSPL_OUTER_HOME}/setup/configuration/setup_all"
fi

#strip -dev,-release,-purify,-quantify,-test,-devdat,-efence
SEL_TARGET=`expr "$SPLICE_TARGET_ENV" : '\([^-]*\)'`

TARGET_DIR="$OSPL_HOME"
if [ -f "$OSPL_OUTER_HOME/setup/configuration/setup_${SEL_TARGET}" ]
then
    TARGET_DIR="$OSPL_OUTER_HOME"
fi
. "$TARGET_DIR/setup/configuration/setup_${SEL_TARGET}"

. "${OSPL_HOME}/setup/configuration/setup_all_dbt"

#target specific dbt setup but only if setup exists
TARGET_DIR="$OSPL_HOME"
if [ -f "$OSPL_OUTER_HOME/setup/configuration/setup_${SEL_TARGET}_dbt" ]
then
    TARGET_DIR="$OSPL_OUTER_HOME"
fi
if [ -f "$TARGET_DIR/setup/configuration/setup_${SEL_TARGET}_dbt" ]
then
    . "$TARGET_DIR/setup/configuration/setup_${SEL_TARGET}_dbt"
fi

unset SEL_TARGET
