#!/bin/sh

echo "---- 1. Removing previous compilation output: make clean ----"
make clean
echo "---- 2. Computing the header dependencies: make depend ----"
make depend
echo "---- 3. Checking for bison version and starting it if possible ---"
BISON=`bison --version`
BISON_MAJOR=`echo $BISON | sed -n 's/^[^0-9]*\([0-9]*\)\..*$/\1/p'` 
BISON_MINOR=`echo $BISON | sed -n 's/^[^\.]*\.\([0-9]*\).*$/\1/p'`
if [ $BISON_MAJOR -gt 1 -o $BISON_MINOR -ge 50 ]
  then
    echo "found usable bison version $BISON_MAJOR.$BISON_MINOR"
    make bison
  else
    echo "using canned bison output since installed bison is too old, needed: version 1.50 or newer"
fi
echo "---- 3. Compiling the system: make ----"
make
