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

# @configure_input@

MAKE=${MAKE-@MAKE@}
MAKEOPTS=

if test -r Makefile; then
  MAKEFILES="-f ${R_HOME}/etc/Makeconf -f Makefile"
else
  MAKEFILES="-f ${R_HOME}/etc/Makeconf"
fi

OBJS=

for i in ${*}; do
  case ${i} in
    *.[cf])
      OBJS="${OBJS} `echo ${i} | sed 's/\.[^\.][^\.]*$/.o/'`"
      ;;
    -D*|*=*)
      MAKEOPTS="${MAKEOPTS} ${i}"
      ;;
    *)
      echo "ERROR:  don't know how to compile ${i}"
      exit 1
      ;;
  esac
done

${MAKE} ${MAKEFILES} ${MAKEOPTS} ${OBJS}

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