#!/bin/bash

#init up
VERSION=${1:-`date +%Y%m%d`}
TO_DIR="reprap-firmware-$VERSION"
FILELIST="extruder_0_ extruder_1_ iobox stepmotor stepmotorb stepmotorc stepmotor-small"

#directory structure
mkdir -p "$TO_DIR"

#make the firmware nice
for F in $FILELIST
do
  cp -p build/16f628/$F/$F.hex $TO_DIR
done

#create our archive
zip -qr "$TO_DIR.zip" "$TO_DIR"

#cleanup
rm -rf "$TO_DIR"

echo "RepRap Firmware Release v$VERSION created as ${TO_DIR}.zip"