#! /bin/csh -f

set X11info = (X11LIBS=-lX11 X11INCL=/usr/include X11LIBDIR=/usr/lib/X11)
set OTHERinfo = (OPTIMIZE=1)

if ($?DISPLAY == 0) then
echo you must run X11 for this script to work.
exit (1)
endif

echo setting PRO and ARCH and path
setenv PRO `(cd ..; pwd)`
setenv ARCH `arch`
set path = ($PRO/bwe/cmd $PRO/bwe/cmd/$ARCH $PRO/cmd $PRO/cmd/$ARCH $path)

if (! -e $PRO/lib) then
echo making lib
(cd $PRO; mkdir lib)
endif

if (! -e $PRO/include) then
echo making include
(cd $PRO; mkdir include)
endif

if (! -e $PRO/bin) then
echo making bin and cmd
(cd $PRO; mkdir bin; ln -s bin cmd)
endif

echo making bwe
make $X11info $OTHERinfo newmachine PRO=$PRO ARCH=$ARCH
make proinstall PRO=$PRO ARCH=$ARCH
make clean PRO=$PRO ARCH=$ARCH

echo done

