#!/usr/bin/env bash

if [ -z "$1" ]; then
   echo 'You must specify the path to SP as the first arg.' >&2
   exit 1
fi

echo -n 'Making sgmlid.o... ' >&2
c++ -fno-implicit-templates -O2 -ansi \
   -I$1 -I$1/include -I$1/generic \
   -DSP_HAVE_BOOL -DSP_ANSI_CLASS_INST -DSP_MULTI_BYTE \
   -c sgmlid.cxx
echo 'done.' >&2

echo -n 'Making sgmlid... ' >&2
c++ -fno-implicit-templates -O2 -ansi \
   -I$1 -I$1/include -I$1/generic \
   -DSP_HAVE_BOOL -DSP_ANSI_CLASS_INST -DSP_MULTI_BYTE \
   -o sgmlid sgmlid.o $1/lib/libsp.a -lm
echo 'done.' >&2

rm sgmlid.o
echo 'Cleaned up sgmlid.o, and completed process.' >&2
