#!/bin/zsh -x
  
cd saffron-framework-sdk
make && make deb
[ $? -ne 0 ] && exit 1
dpkg -i build/saffron-*.deb
cd ..

cd saffron-msgs
make && make deb
[ $? -ne 0 ] && exit 1
dpkg -i build/saffron-*.deb
cd ..


for i in `ls saffron* -d`
do
        cd $i
        if [ -e "Makefile" ]
        then
                make && make deb
#               [ $? -ne 0 ] && exit 1
        fi
        cd ..

done
rm -rf debPackage /opt/debPackage
mkdir -p /opt/debPackage
find ./ -name "saffron-*.deb"  -exec cp {} /opt/debPackage \;
mv /opt/debPackage ./
