#! /bin/csh -f
# Last edited on 2008-02-04 20:52:50 by stolfi

set usage = "$0 RA..."

# Re-generates the images for MC930 static homework hand-ins.
# Arguments are RA numbers of students to process.
# For each student, expecs to find the files
#   ${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.png - hand-in image (rebuilt to standard size)

if ( $#argv < 1 ) then
  echo "usage: ${usage}"; exit 1
endif

set ras = ( $* )

set imgfile = "main.png"
set povfile = "main.pov"

foreach ra ( ${ras} )
  # Ckeck if the POV-ray source exists.
  # If so, re-build the image 
  if ( -r ${ra}/${povfile} ) then
    echo "=== (re)building ${imgfile} in ${ra} ===================="
    ( cd ${ra} && make image ; echo " " )
    echo "=== done rebuilding ${ra} =============================="
  else
    echo "${ra}/main.pov does not exist"
  endif
end