#!/bin/sh
#
# ${R_HOME}/bin/SHLIB

# @configure_input@

VERSION="0.1-2"
USAGE_MSG="Usage:  R SHLIB [-o lib] obj_1 ... obj_n"

lib=
OBJS=
DEBUG=false
MAKE=${MAKE-@MAKE@}

while test -n "${1}"; do
  if ${DEBUG}; then
    echo "$0 -- DEBUG: arg = \`${1}'";
  fi
  case ${1} in
    -h|--help|-\?)
       echo "${USAGE_MSG}"; exit 0 ;;
    -V|--version)
       echo "${VERSION}"; exit 0 ;;
    --debug)
      DEBUG=true ;;
    -o)
      lib=${2}; shift ;;
    *.?)
      if test -z "${lib}"; then
	lib="`echo ${1} | sed 's/\.[^\.][^\.]*$/.@SHLIBEXT@/'`"
      fi
      OBJS="${OBJS} `echo ${1} | sed 's/\.[^\.][^\.]*$/.o/'`"
      ;;
  esac
  shift
done

${MAKE} -f ${R_HOME}/etc/Makeconf SHLIB="${lib}" OBJS="${OBJS}"

### Local Variables: ***
### mode: sh ***
### sh-indent: 2 ***
### End: ***
