#!/bin/sh
#
# Starlab make helper.
#
# Compile a C++ source file $1 iff it is non-null.
# Other arguments give compile command, switches, etc.

if [ $# -lt 2 ]; then
    echo "Usage: $0  srcfile.C  compiler opts ..." >&2
    exit 1
fi
#
src="$1"
shift
#
if [ -f "$src" -a ! -s "$src" ]; then
    touch "$src"
else
    date=`date +%a_%b_%d_%Y,_%T_%Z`
    echo "$* -c $src -D_COMPILE_DATE_=\"$date\""
    $*  -c $src -D_COMPILE_DATE_=\"$date\"
fi
