7 echo "$PROG [ocamldep ... ]"
17 OPTIONS="$OPTIONS $1 $2"
21 OPTIONS="$OPTIONS $1 $2"
22 INCLUDES="$INCLUDES $2"
36 if test "$#" -eq 0; then break; else shift; fi
39 if test "$NATIVE" -eq 1; then
47 $OPTIONS -modules "$src" | while read file deps; do
48 if test -z "$file"; then continue; fi
50 if test "$file" != "${file%.mli}"; then
61 modbase=$(echo $dep | sed 's/\(.*\)/\l\1/')
62 for dir in $INCLUDES; do
63 dir=${dir%/} #remove trailing slash, if any
64 #Interfaces or bytecode objects depends on other compile interfaces
65 #if they exists, otherwise they depend on the object
66 if test \( "$ext" = "cmi" -o "$ext" = "cmo" \) -a -f "$dir"/"$modbase".mli ; then
67 dependencies="$dependencies $dir/$modbase".cmi
69 elif test -f "$dir"/"$modbase".ml -o -f "$dir"/"$modbase".mly -o -f "$dir"/"$modbase".mll -o -d "$dir"/"$modbase"; then
70 dependencies="$dependencies $dir/$modbase"."$ext"
75 #finally add the cmi as dependency of the cmo/cmx,
77 if test "$ext" != "cmi" -a -f "$base".mli ; then
78 dependencies=" ${base}.cmi${dependencies}"
80 #output a phony dependency between the cmi and the cmx/cmo if there is no .mli
81 if test "$ext" != "cmi" -a ! -f "$base".mli; then
82 echo "${base}.cmi: ${base}.${ext}"
84 echo "${base}.${ext}:${dependencies}"