#!/bin/sh
# Runs Pike directly from the build directory.

BUILDDIR=/home/grubba/src/Pike/7.2/build/darwin-1.3.2-power-macintosh

if test $BUILDDIR = BUILDDIR; then
  echo Run make in the parent directory to generate this script.
  exit 1
fi

if test x"$1" = x--gdb; then
  shift
  args="set args '-m$BUILDDIR/master.pike'"
  for arg do
    arg=`echo $arg | sed -e s/\'/\'\"\'\"\'/g`
    args="$args '$arg'"
  done
  if test -f .gdbinit; then
    mv .gdbinit .gdbinit.orig
    cp .gdbinit.orig .gdbinit
  fi
  echo $args >> .gdbinit
  gdb "$BUILDDIR/pike"
  rm .gdbinit
  test -f .gdbinit.orig && mv .gdbinit.orig .gdbinit
else
  exec "$BUILDDIR/pike" "-m$BUILDDIR/master.pike" "$@"
fi
