#!/bin/sh
#
#  BuildBin -- build selected graphics executables into ../bin

#  If not configured for graphics, quit immediately
grep '#define *Graphics' ../src/h/define.h >/dev/null || exit 0

#  Standard list of programs
GPROGS="colrbook colrpick fontpick palette wevents xgamma"
GPACKS="vib"

#  Set paths
TOP=`cd ..; pwd`
BIN=$TOP/bin
PATH=$BIN:$PATH
IPATH=$TOP/lib
LPATH=$TOP/lib
export PATH IPATH LPATH

#  Figure out executable extension
EXE=`grep '^EXE' ../Makedefs | sed 's/.*= *//'`

#  Build graphics programs
cd gprogs
for p in $GPROGS; do
    (set -x; icont -usN $p)
    mv $p$EXE $BIN
done
cd ..

#  Build graphics packages
for p in $GPACKS; do
    cd gpacks/$p
    ${MAKE-make} Clean
    ${MAKE-make} IFLAGS=-usN
    cp $p$EXE $BIN
    cd ../..
done
