#! /bin/sh
#
#   buildout <server_type> [<make_args>]*
#
#     <server_type> should be one of 'squid', 'zope', or 'zeo' (or some
#       other server instance for whom we have a specific makefile)
#
#     <makefile_args> are additional arguments to pass to make, e.g.
#       'compile', 'install', etc.
#
reldir=`dirname $0`
reldir=`realpath $reldir`
server_type=$1
shift

if [ -n "$PYTHONHOME" -o -n "$PYTHONPATH" ]; then
  echo "** Python build is likely to malfunction if either of" 1>&2
  echo "** PYTHONHOME ('$PYTHONHOME') or PYTHONPATH ('$PYTHONPATH')" 1>&2
  echo "** is set - please unset them before doing the buildout." 1>&2
  exit 1
fi

if [ -f $reldir/Makefile.$server_type ]; then
  /usr/bin/make -f $reldir/Makefile.$server_type \
                -I $reldir MAKEFILEDIR=$reldir $@
else
  echo "buildout <server_type> [make_args]*"

fi
