# !/bin/sh
# ###############################################
# (c) 2013 Mulle kybernetiK
# Coded by Nat!
#
# Put this script in a Run Script phase of your
# target.
# Set your EOModels as a source for this script 
# and a C-file as the output for it. The rest
# should just work.
#
outfile="$SCRIPT_OUTPUT_FILE_0"

models="$SCRIPT_INPUT_FILE_0"
modelnames=`basename $SCRIPT_INPUT_FILE_0`
memo=`[ "$models" -nt "$outfile" ]`

i=1
while [ $i -lt $SCRIPT_INPUT_FILE_COUNT ]
do
   filename="SCRIPT_INPUT_FILE_$i"
   if [ "$filename" -nt "$outfile" ]
   then
     memo=0
   fi

   models="$models $filename"
   modelnames="$modelnames `basename $filename`"
   i=`expr $i + 1`
done

#
# allows build with a distributions w/o having mulle-plist-from-files
# installed (within reason :))
#
if [ memo ]
then
   exit 0
fi

modelname=`basename "$model"`

MULLE_PLIST_HEADER="/* DONT EDIT!! This file is autogenerated from $modelnames by mulle-plist-from-files */
char eomodelgroup_as_plist[] = \""


MULLE_PLIST_FOOTER='";'

export MULLE_PLIST_HEADER
export MULLE_PLIST_FOOTER


PATH=/usr/local/bin:$PATH

mulle-plist-from-files "$models" | mulle-plist-compress > "$outfile"