#!/usr/bin/zsh

#
#  This can be installed in /usr/local/bin if you like
#

#
# Provide hooks for setting the various OMNI environment variables.
#
if [ -f /usr/local/etc/zomnimake ]; then
  source /usr/local/etc/zomnimake
fi

if [ -f $HOME/.zomnimake ]; then
  source $HOME/.zomnimake
fi

#
# Make sure the utilities and Makefiles directories are checked out.
#
if [ ! -d $OMNIMAKE_ROOT/utilities ]; then
    echo $OMNIMAKE_ROOT/utilities does not exist.
    echo You must checkout the utilities directory to use omnimake.
    exit 1
fi
if [ ! -d $LOCAL_MAKEFILEDIR ]; then
    echo $LOCAL_MAKEFILEDIR does not exist.
    echo You must checkout the Makefiles directory to use omnimake.
    exit 1
fi

#
# Workaround for Rhapsody DR bug where processes started from ProjectBuilder
# have an effective group id of 0 (triggering perl's paranoid secure mode
# where you can't have a generic PATH).
#
EGID=$GID

#
# Perform the actual build using omnimake.perl.
#

exec perl $OMNIMAKE_ROOT/utilities/omnimake.perl "$@"
