#! /bin/sh


if [ ! "1" = "$#" ]
then
   echo "usage: make-all-flavors install-prefix"
   echo ""
   echo "makes a version of the test-app for all lib flavors available"
   echo "for the current architecture under the install-prefix dir."
   exit 1
fi


globus_install_prefix="$1"

if [ -x "${globus_install_prefix}/sbin/config.guess" ]
then
   current_arch=`${globus_install_prefix}/sbin/config.guess`
else
   echo "cannot build for architecture type!"
   exit 1
fi

if [ -d "${globus_install_prefix}/development" ]
then
   flavordirs="${globus_install_prefix}/development/${current_arch}*"
else
   echo "no libraries found for current architecture!"
fi


for flavordir in ${flavordirs}
do
   flavor=`echo "${flavordir}" | sed -e 's|.*/\([^/]*\)|\1|g'`
   GLOBUS_LIB_PREFIX="${flavordir}" gmake clean > /dev/null 2>&1
   { GLOBUS_LIB_PREFIX="${flavordir}" gmake > /dev/null 2>&1 && \
     mv -f globus-duroc-test-app "globus-duroc-test-app.${flavor}" ; } && \
   echo "globus-duroc-test-app.${flavor}" || \
   echo "globus-duroc-test-app.${flavor} failed!"
   GLOBUS_LIB_PREFIX="${flavordir}" gmake clean > /dev/null 2>&1
done


