]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
depcomp: support tcc (Tiny C Compiler)
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 27 Mar 2012 15:55:07 +0000 (17:55 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 27 Mar 2012 19:56:55 +0000 (21:56 +0200)
This change fixes automake bug#11007.

Since git commit 0c928da9 of 21-06-2010, "tcc: Draft suppoprt for
-MD/-MF options" (sic, with typo in summary line), tcc has supported
automatic dependency generation with a command-line interface
similar to what old (pre-8.0) Intel compilers did.  This caused
Automake-generated code for automatic dependency tracking to
recognize tcc dependency style as "icc".  However, the format of
the dependency files generated by tcc is apparently different enough
from that of icc to cause spurious failures in the post-processing
operated by our 'depcomp' script on such files.

The failure was exposed with the development version of tcc 0.9.26
(as installed with debian package "tcc 0.9.26~git20120104.83d") by
test case 'depcomp-auto.tap' (available only in the master branch).

* lib/depcomp (icc): Cater to tcc as well.  Update comments
accordingly.
* NEWS: Update.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
NEWS
lib/depcomp

diff --git a/NEWS b/NEWS
index 8809d2c78b1da84af9d77b52cf12ef7547621208..11ce4c92244a2a61edd5858d667231deeee8796e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,11 @@ New in 1.11.0a:
 
 * Miscellaneous changes:
 
+  - There is an initial, experimental support for automatic dependency
+    tracking with tcc (the Tiny C Compiler).  Its associated depmode is
+    currently recognized as "icc" (but this and other details are likely
+    to change in future versions).
+
   - Automatic dependency tracking now works also with the IBM XL C/C++
     compilers, thanks to the new new depmode 'xlc'.
 
index 325713f0c434edda4692bbf10fb965b7808c197e..25a39e6cd5c82d7276f6ccc62ef5e7ba1cc9776f 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2012-03-12.15; # UTC
+scriptversion=2012-03-27.16; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
 # 2011, 2012 Free Software Foundation, Inc.
@@ -289,23 +289,26 @@ aix)
   ;;
 
 icc)
-  # Intel's C compiler understands '-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+  # However on
+  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
   # ICC 7.0 will fill foo.d with something like
   #    foo.o: sub/foo.c
   #    foo.o: sub/foo.h
-  # which is wrong.  We want:
+  # which is wrong.  We want
   #    sub/foo.o: sub/foo.c
   #    sub/foo.o: sub/foo.h
   #    sub/foo.c:
   #    sub/foo.h:
   # ICC 7.1 will output
   #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using :
+  # and will wrap long lines using '\':
   #    foo.o: sub/foo.c ... \
   #     sub/foo.h ... \
   #     ...
-
+  # tcc 0.9.26 (FIXME still under development at the moment of writing)
+  # will emit a similar output, but also prepend the continuation lines
+  # with horizontal tabulation characters.
   "$@" -MD -MF "$tmpdepfile"
   stat=$?
   if test $stat -eq 0; then :
@@ -318,11 +321,17 @@ icc)
   # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
   # Do two passes, one to just change these to
   # '$object: dependent.h' and one to simply 'dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
+  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
+    < "$tmpdepfile" > "$depfile"
+  sed '
+    s/[ '"$tab"'][ '"$tab"']*/ /g
+    s/^ *//
+    s/ *\\*$//
+    s/^[^:]*: *//
+    /^$/d
+    /:$/d
+    s/$/ :/
+  ' < "$tmpdepfile" >> "$depfile"
   rm -f "$tmpdepfile"
   ;;