]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* m4/depend.m4 (AM_DEPENDENCIES): Add check for `makedepend'.
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Mon, 31 May 1999 23:43:32 +0000 (23:43 +0000)
committerAlexandre Oliva <oliva@dcc.unicamp.br>
Mon, 31 May 1999 23:43:32 +0000 (23:43 +0000)
Fix `dashmstdout' to ignore non-dependency-generating uses of the
-M flag.
* depcomp (makedepend): New dependency-generating method.

ChangeLog
depcomp
m4/depend.m4

index b851dace64ecf52c819742a88477372e008bfd88..0fc8cbd1e297cda71fc8bf2796c8f16d18180db0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+1999-06-01  Miles Bader  <miles@ccs.mt.nec.co.jp>
+
+       * m4/depend.m4 (AM_DEPENDENCIES): Add check for `makedepend'.
+       Fix `dashmstdout' to ignore non-dependency-generating uses of the
+       -M flag.
+       * depcomp (makedepend): New dependency-generating method.
+
 1999-06-01  Alexandre Oliva  <oliva@dcc.unicamp.br>
 
        * missing: If given `--run' as first argument, try to run the
diff --git a/depcomp b/depcomp
index 951a984ca057ceb5cd4d211232b0b64a24fb68fb..8e57e32fecb7af545dff813955d482b38e0a6221 100755 (executable)
--- a/depcomp
+++ b/depcomp
@@ -122,6 +122,42 @@ dashmstdout)
   rm -f "$tmpdepfile"
   ;;
 
+makedepend)
+  # X makedepend
+  (
+    shift
+    cleared=no
+    for arg in "$@"; do
+      case $cleared in no)
+        set ""; shift
+       cleared=yes
+      esac
+      case "$arg" in
+        -D*|-I*)
+         set fnord "$@" "$arg"; shift;;
+       -*)
+         ;;
+       *)
+         set fnord "$@" "$arg"; shift;;
+      esac
+    done
+    obj_suffix="`echo $object | sed 's/^.*\././'`"
+    touch "$tmpdepfile"
+    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile" 
+  cat < "$tmpdepfile" > "$depfile"
+  tail +3 "$tmpdepfile" | tr ' ' '
+' | \
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
 cpp)
   # Important note: in order to support this mode, a compiler *must*
   # always write the proprocessed file to stdout, regardless of -o,
index f69ee5bdfeddfefd299272012b47baa07df800e1..70c489397095e003eb03d7572fb103b8842f2308 100644 (file)
@@ -45,12 +45,26 @@ else
 
    if test "$am_cv_[$1]_dependencies_compiler_type" = none; then
       # -o /dev/null avoids selecting -M for a compiler that would
-      # output dependencies to the object file
-      if test -n "`$depcc -M conftest.c -o /dev/null 2>/dev/null`"; then
+      # output dependencies to the object file.
+      # The grep tries to ignore compilers that actually output
+      # something other than dependency information when given the -M
+      # argument (in particular, linker map information).
+      rm -f conftest.P
+      if $depcc -M conftest.c -o /dev/null >conftest.P 2>/dev/null &&
+        grep "conftest.h" conftest.P > /dev/null; then
         am_cv_[$1]_dependencies_compiler_type=dashmstdout
       fi
    fi
 
+   if test "$am_cv_[$1]_dependencies_compiler_type" = none; then
+      rm -f conftest.P
+      touch conftest.P
+      if ${MAKEDEPEND-makedepend} -o.o -fconftest.P conftest.c 2>/dev/null &&
+       grep "conftest.h" conftest.P > /dev/null; then
+        am_cv_[$1]_dependencies_compiler_type=makedepend
+      fi
+   fi
+
    if test "$am_cv_[$1]_dependencies_compiler_type" = none; then
       # -o /dev/null avoids selecting -E for a compiler that would
       # output dependencies to the object file