CEG=$TARGET_HOME/lib.bin/ceg/util

case $# in
  2) case $1 in
	-as)	MAKE=$CEG/make_asobj;OBJ=as;;
	-obj)	MAKE=$CEG/make_asobj;OBJ=obj;;
	   *) echo wrong option $1, use -as or -obj;
     	      exit 1;;
     esac
     SRC_DIR=$2
     ;;

  1) MAKE=$CEG/make_own;OBJ=obj;SRC_DIR=$1
     ;;

  *) echo "Usage: $0 [-as|-obj] <source directory>"
     exit 1
     ;;
esac

case X$MACH in
X)	MACH=`expr $SRC_DIR : '.*/mach/\(.*\)/ce*`
	;;
esac
case X$MACH in
X)	echo environment definition for MACH required
	exit 1
	;;
esac
make -f $MAKE OBJ=$OBJ MACH=$MACH SRC_DIR=$SRC_DIR install
