#! /bin/bash # Last edited on 2009-10-10 22:48:44 by stolfilocal usage="$0 {TARGETS} {RA}..." # Re-generates the images for MC930 animated homework hand-ins. # Arguments are RA numbers of students to process. # # The {TARGETS} argument must be a list of targets for make, # separated by commas (e.g. "strip,movie" or "all"). # # For each student, expects to find the file # ${ra}/main.pov - the student's orignal main POV-ray file. # ${ra}/Makefile - homework-specific "rebuild" Makefile (us. link). # (Re)generates the files # ${ra}/main-0.0000{,-i}.png - First frame and icon # ${ra}/main-0.5000{,-i}.png - Middle frame and icon # ${ra}/main-1.0000{,-i}.png - Last frame and icon # ${ra}/main-m.gif - Animated gif with movie (rebuilt to standard size) # ${ra}/main-s.png - Strip with sample frames # export PATH=".:tools:../tools:../../tools:../../../tools:../../../../tools:${PATH}" if [[ $#argv < 1 ]]; then echo "usage: ${usage}" 1>&2; exit 1 fi targets=( `echo "$1" | tr ',' ' '` ); shift if [[ $#argv < 1 ]]; then echo "usage: ${usage}" 1>&2; exit 1 fi ras=( "$@" ) povfile="main.pov" for ra in ${ras[@]} ; do # Ckeck if the POV-ray source exists. # If so, re-build the image if [[ -r ${ra}/${povfile} ]]; then echo "=== (re)building ${targets} in ${ra} ====================" 1>&2 ( cd ${ra} && make -f Makefile ${targets[@]}; echo " " ) echo "=== done rebuilding ${ra} ==============================" 1>&2 else echo "${ra}/main.pov does not exist" 1>&2 fi done