#!/bin/sh
#set -x    # for debugging

# variables

cc=gcc
cpp=
local=
osdef=

while [ $# -ne 0 ]
do
        case $1 in
        -cc)        cc=$2;                                     shift; shift;;
        -local)     local=true;                                shift;;
        -solaris)   osdef="$osdef -Dsolaris -DSYSV -DSVR4";    shift;;
        -*)         echo unknown option $1;                    shift;;
        *)          echo input $1 ignored;                     shift;;
        esac
done

if [ -n "$local" ] 
then
	cd config;
	make clean; 
	make -f Makefile.ini CC=$cc BOOTSTRAPCFLAGS="$osdef"; 
	cd ..	
	./config/imake -T./config/Imake.tmpl -I./config -DDEFINES="'$osdef'" -DTOPDIR=. -DCURDIR=. 
else
	xmkmf
fi

echo creating Makefiles...
make Makefiles
make

exit 0
















