X-Git-Url: http://git.nguyen.vg/gitweb/?p=tatoo.git;a=blobdiff_plain;f=tools%2Focamlmoduledep.sh;h=857531226f2048ab18bd01de6217c9d378146c4f;hp=befd4cdfd1b110a091b39017d2a0eb3ce1f195eb;hb=31d45495fda9a110fd348f8b492761c28b434ec9;hpb=fa7e819743a4a6d008ec086dfdeb2e30df2da701 diff --git a/tools/ocamlmoduledep.sh b/tools/ocamlmoduledep.sh index befd4cd..8575312 100755 --- a/tools/ocamlmoduledep.sh +++ b/tools/ocamlmoduledep.sh @@ -4,7 +4,7 @@ PROG="$0" CMDLINE="$*" usage() { - echo "$PROG [-native] [-I dir .. -I dir] Module" + echo "$PROG [-inter] [-native] [-I dir .. -I dir] Module" } INCLUDES="" @@ -16,7 +16,7 @@ while true; do -I) dir=`echo "$2" | sed "s:^+:$(ocamlc -where)/:"` INCLUDES="$INCLUDES -$2" +$dir" shift ;; -native) @@ -46,15 +46,19 @@ 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 + if test -z "$include"; then continue; fi base="$include/$module" - if test -z "$include"; then continue; fi if test \( "$INTER" = "1" \) -a \( -f "$base".mli \) ; then - echo -n "$base"."cmi " - elif test -f "$base".ml -o -f "$base".mly -o -f "$base".mll -o -f "$base".pack; then - echo -n "$base"."$ext " + ## if we want to depend only on cmi of a module + /bin/echo -n "$base"."cmi " + elif test -f "$base".ml -o -f "$base".mly -o -f "$base".mll -o -f "$base".pack -o -f "$base".ml.str; then + ## else we depend on the implementation + /bin/echo -n "$base"."$ext " break elif test -f "$base".mli; then - echo -n "$base"."cmi " + ## and fall back on depending on the cmi if the cmx is not available + ## (which prevents cross-module inlining in the case of cmx) + /bin/echo -n "$base"."cmi " break fi done