ocaml/tools/ocamlcp

29 lines
493 B
Bash
Executable File

#!/bin/sh
toremove=""
cslargs="profiling.cmo"
profargs=""
while : ; do
case "$1" in
"")
break;;
-p)
profargs="$profargs -m $2"; shift;;
-I|-o|-ccopt|-cclib)
cslargs="$cslargs $1 $2"; shift;;
*.ml)
toremove="$toremove ${1}t"
cslprof -instrument $profargs $1 > ${1}t || { rm -f $toremove; exit 2; }
cslargs="$cslargs ${1}t";;
*)
cslargs="$cslargs $1";;
esac
shift
done
ocamlc $cslargs
status=$?
rm -f $toremove
exit $status