#!/bin/ksh -p
#
#  BuildExe -- build executables in ./iexe
#
#  Includes programs from pack directories, but excludes mprogs.
#  Assumes that ../bin and ../lib have been built.

set -x

export LC_ALL=POSIX

#  Set minimal path needed.  Not all systems have all these directories
TOP=`cd ..; pwd`
export PATH=$TOP/bin:/usr/xpg4/bin:/usr/ccs/bin:/bin:/usr/bin
export IPATH=$TOP/lib
export LPATH=$TOP/lib

#  Use default Icon options for packages that include an Icon execution
unset BLKSIZE STRSIZE MSTKSIZE COEXPSIZE TRACE NOERRBUF FPATH


#  Build progs and gprogs
test -d iexe || mkdir iexe
cd iexe
for f in ../progs/*icn ../gprogs/*icn; do
    icont -us $f
done
cd ..


#  Build packages
for d in *packs/[a-z]*; do
    echo $d
    (cd $d; make Clean; ${MAKE-make} Iexe)
done
