X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=tools%2Focamlmoduledep.sh;h=3bab18669ef3a3c5fe32d86f76f3284084d9a28e;hp=3102e1ecc147db0f9758ab236fe4dcc7db659582;hb=31514b441ce29f78c114e9d912ba09f37f91d257;hpb=f7a43114461b09d79c94a0da51ffbe1aea43dc55 diff --git a/tools/ocamlmoduledep.sh b/tools/ocamlmoduledep.sh index 3102e1e..3bab186 100755 --- a/tools/ocamlmoduledep.sh +++ b/tools/ocamlmoduledep.sh @@ -8,7 +8,7 @@ usage() { } INCLUDES="" -MODULE="" +MODULES="" NATIVE=0 while true; do case $1 in @@ -22,12 +22,7 @@ $2" NATIVE=1 ;; [A-Z]*) - if test -z "$MODULE"; then - MODULE=$1 - else - usage - exit 1 - fi + MODULES="$MODULES $1" ;; *) echo "ERROR: '$1'" @@ -38,20 +33,24 @@ $2" shift if test "$#" -eq 0; then break; fi done -module="$(echo $MODULE | cut -b1 | tr A-Z a-z)$(echo $MODULE | cut -b2-)" if test "$NATIVE" = "1"; then ext=cmx else ext=cmo fi -echo "$INCLUDES" | while read include; do - base="$include/$module" - if test -f "$base".ml -o -f "$base".mly -o -f "$base".mll -o -d "$base"; then - echo "$base"."$ext" - break - elif test -f "$base".mli; then - echo "$base".cmi - break - fi +for MODULE in $MODULES; do + module="$(echo $MODULE | cut -b1 | tr A-Z a-z)$(echo $MODULE | cut -b2-)" + echo "$INCLUDES" | while read include; do + base="$include/$module" + if test -z "$include"; then continue; fi + if test -f "$base".ml -o -f "$base".mly -o -f "$base".mll -o -f "$base".pack; then + echo -n "$base"."$ext " + break + elif test -f "$base".mli; then + echo -n "$base"."cmi " + break + fi + done done +echo