From: Robbert VanRenesse <rvr@cs.cornell.edu>
Date: Fri, 3 Nov 1995 14:20:29 -0500
Message-Id: <199511031920.OAA01257@gungnir.cs.cornell.edu>
To: caml-list@pauillac.inria.fr
Subject: mkdepend for caml programs
I wasn't aware of the existence of one, so I produced the following.
I'm not entirely sure of its correctness, but it's a start. If
somebody knows of a better one, I'd be interested.
Robbert
----------8<----------8<----------8<----------8<----------8<----------
#
# camldep -- produce Makefile dependencies for caml programs.
#
# Usage: camldep *.ml *.mli >> Makefile
#
for file
do
case $file in
*.ml) base=`basename $file .ml`
obj=$base.zo
dep="$base"
;;
*.mli) base=`basename $file .mli`
obj=$base.zi
dep=""
;;
*) echo "Unknown file type: $file" >&2
exit 1
esac
echo -n $obj: $file
dep="$dep "`sed -n -e 's/.*#open *"\([^"]*\)".*/\#\#\1/p' \
-e 's/\([a-zA-Z][a-zA-Z0-9_]*\)__[a-zA-Z][a-zA-Z0-9_]*/\\
\##\\1\\
/gp' $file | sed -n -e "/##$base/d" -e 's/^##\(.*\)/\1/p' | sort -u`
for i in $dep
do
if test -f $i.mli
then
echo -n " $i.zi"
elif test -f $i.ml -a $i != $base
then
echo -n " $i.zo"
fi
done
echo
done