#!/bin/sh

. config/options

$SCRIPTS/build m4
$SCRIPTS/build libtool

# build for host
  setup_toolchain host

  cd $BUILD/$1*
  mkdir -p .objdir-host
  cd .objdir-host

  EMACS="no" \
  ac_cv_path_M4=$ROOT/$TOOLCHAIN/bin/m4 \
  ac_cv_prog_gnu_m4_gnu=no \
  ../configure --host=$HOST_NAME \
               --build=$HOST_NAME \
               --target=$TARGET_NAME \
               --prefix=$ROOT/$TOOLCHAIN \

  make
  make install

  cd $ROOT

# build for target
  setup_toolchain target

  cd $BUILD/$1*
  mkdir -p .objdir-target
  cd .objdir-target

  EMACS="no" \
  ac_cv_path_M4=$ROOT/$TOOLCHAIN/bin/m4 \
  ac_cv_prog_gnu_m4_gnu=no \
  ../configure --host=$TARGET_NAME \
               --build=$HOST_NAME \
               --prefix=$SYSROOT_PREFIX/usr \

  make
  make install
