#!/bin/sh
#

SRCROOT=$1
DERIVED_FILE_DIR=$2

MANUMBER_MFILES="MAConcreteNumber0.m MAConcreteNumber1.m"

MATHTEMPLATE_MFILES="MathTemplateArray1.m \
	MathTemplateArray2.m \
	MathTemplateArray3.m \
	MathTemplateArray4.m \
	MathTemplateArray5.m \
	MathTemplateArray6.m \
	MathTemplateArray7.m \
	MathTemplateArray8.m \
	MathTemplateArray9.m \
	MathTemplateArray10.m \
	MathTemplateArray11.m \
	MathTemplateArray12.m"

MATHCOMPLEX_MFILES="MathComplexArray1.m MathComplexArray2.m"

# Compilation of class clusters
  for file in $MANUMBER_MFILES; do
	echo Creating $file
	rm -f $DERIVED_FILE_DIR/$file
	echo '#define MATH_ORDER' `echo $file | sed -e "s,[^0-9],,g"` > $DERIVED_FILE_DIR/$file
	cat $SRCROOT/MAConcreteNumber.m >> $DERIVED_FILE_DIR/$file
  done

  for file in $MATHTEMPLATE_MFILES; do
	echo Creating $file
	rm -f $DERIVED_FILE_DIR/$file
	echo '#define MATH_ORDER' `echo $file | sed -e "s,[^0-9],,g"` > $DERIVED_FILE_DIR/$file
	cat $SRCROOT/MathTemplateArray.m >> $DERIVED_FILE_DIR/$file
  done

  for file in $MATHCOMPLEX_MFILES; do
	echo Creating $file
	rm -f $DERIVED_FILE_DIR/$file
	echo '#define MATH_ORDER' `echo $file | sed -e "s,[^0-9],,g"` > $DERIVED_FILE_DIR/$file
	cat $SRCROOT/MathComplexArray.m >> $DERIVED_FILE_DIR/$file
  done

