Changeset 39aab06a in rtems for depcomp


Ignore:
Timestamp:
May 18, 2012, 5:11:47 AM (9 years ago)
Author:
Ralf Corsépius <ralf.corsepius@…>
Branches:
4.11, 5, master
Children:
bbb69abb
Parents:
8bbf69e
Message:

Update from automake-1.11.5.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • depcomp

    r8bbf69e r39aab06a  
    22# depcomp - compile a program generating dependencies as side-effects
    33
    4 scriptversion=2011-12-04.11; # UTC
     4scriptversion=2012-03-27.16; # UTC
    55
    66# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
    7 # 2011 Free Software Foundation, Inc.
     7# 2011, 2012 Free Software Foundation, Inc.
    88
    99# This program is free software; you can redistribute it and/or modify
     
    2929case $1 in
    3030  '')
    31      echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
     31     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
    3232     exit 1;
    3333     ;;
     
    4141Environment variables:
    4242  depmode     Dependency tracking mode.
    43   source      Source file read by `PROGRAMS ARGS'.
    44   object      Object file output by `PROGRAMS ARGS'.
     43  source      Source file read by 'PROGRAMS ARGS'.
     44  object      Object file output by 'PROGRAMS ARGS'.
    4545  DEPDIR      directory where to store dependencies.
    4646  depfile     Dependency file to output.
     
    5858esac
    5959
     60# A tabulation character.
     61tab='   '
     62# A newline character.
     63nl='
     64'
     65
    6066if test -z "$depmode" || test -z "$source" || test -z "$object"; then
    6167  echo "depcomp: Variables source, object and depmode must be set" 1>&2
     
    101107   cygpath_u='sed s,\\\\,/,g'
    102108   depmode=msvc7
     109fi
     110
     111if test "$depmode" = xlc; then
     112   # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
     113   gccflag=-qmakedep=gcc,-MF
     114   depmode=gcc
    103115fi
    104116
     
    157169  sed -e 's/^[^:]*: / /' \
    158170      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
    159 ## This next piece of magic avoids the `deleted header file' problem.
     171## This next piece of magic avoids the "deleted header file" problem.
    160172## The problem is that when a header file which appears in a .P file
    161173## is deleted, the dependency causes make to die (because there is
     
    163175## dummy dependencies for each header file.  Too bad gcc doesn't do
    164176## this for us directly.
    165   tr ' ' '
    166 ' < "$tmpdepfile" |
    167 ## Some versions of gcc put a space before the `:'.  On the theory
     177  tr ' ' "$nl" < "$tmpdepfile" |
     178## Some versions of gcc put a space before the ':'.  On the theory
    168179## that the space means something, we add a space to the output as
    169180## well.  hp depmode also adds that space, but also prefixes the VPATH
     
    204215    # lines with more than a fixed number of characters (4096 in
    205216    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
    206     # the IRIX cc adds comments like `#:fec' to the end of the
     217    # the IRIX cc adds comments like '#:fec' to the end of the
    207218    # dependency line.
    208     tr ' ' '
    209 ' < "$tmpdepfile" \
     219    tr ' ' "$nl" < "$tmpdepfile" \
    210220    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
    211     tr '
    212 ' ' ' >> "$depfile"
     221    tr "$nl" ' ' >> "$depfile"
    213222    echo >> "$depfile"
    214223
    215224    # The second pass generates a dummy entry for each header file.
    216     tr ' ' '
    217 ' < "$tmpdepfile" \
     225    tr ' ' "$nl" < "$tmpdepfile" \
    218226   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
    219227   >> "$depfile"
     
    227235  ;;
    228236
     237xlc)
     238  # This case exists only to let depend.m4 do its work.  It works by
     239  # looking at the text of this script.  This case will never be run,
     240  # since it is checked for above.
     241  exit 1
     242  ;;
     243
    229244aix)
    230245  # The C for AIX Compiler uses -M and outputs the dependencies
    231246  # in a .u file.  In older versions, this file always lives in the
    232   # current directory.  Also, the AIX compiler puts `$object:' at the
     247  # current directory.  Also, the AIX compiler puts '$object:' at the
    233248  # start of each line; $object doesn't have directory information.
    234249  # Version 6 uses the directory in both cases.
     
    260275  done
    261276  if test -f "$tmpdepfile"; then
    262     # Each line is of the form `foo.o: dependent.h'.
     277    # Each line is of the form 'foo.o: dependent.h'.
    263278    # Do two passes, one to just change these to
    264     # `$object: dependent.h' and one to simply `dependent.h:'.
     279    # '$object: dependent.h' and one to simply 'dependent.h:'.
    265280    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
    266     # That's a tab and a space in the [].
    267     sed -e 's,^.*\.[a-z]*:[      ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
     281    sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    268282  else
    269283    # The sourcefile does not contain any dependencies, so just
     
    276290
    277291icc)
    278   # Intel's C compiler understands `-MD -MF file'.  However on
    279   #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
     292  # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
     293  # However on
     294  #    $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
    280295  # ICC 7.0 will fill foo.d with something like
    281296  #    foo.o: sub/foo.c
    282297  #    foo.o: sub/foo.h
    283   # which is wrong.  We want:
     298  # which is wrong.  We want
    284299  #    sub/foo.o: sub/foo.c
    285300  #    sub/foo.o: sub/foo.h
     
    288303  # ICC 7.1 will output
    289304  #    foo.o: sub/foo.c sub/foo.h
    290   # and will wrap long lines using \ :
     305  # and will wrap long lines using '\':
    291306  #    foo.o: sub/foo.c ... \
    292307  #     sub/foo.h ... \
    293308  #     ...
    294 
     309  # tcc 0.9.26 (FIXME still under development at the moment of writing)
     310  # will emit a similar output, but also prepend the continuation lines
     311  # with horizontal tabulation characters.
    295312  "$@" -MD -MF "$tmpdepfile"
    296313  stat=$?
     
    301318  fi
    302319  rm -f "$depfile"
    303   # Each line is of the form `foo.o: dependent.h',
    304   # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
     320  # Each line is of the form 'foo.o: dependent.h',
     321  # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
    305322  # Do two passes, one to just change these to
    306   # `$object: dependent.h' and one to simply `dependent.h:'.
    307   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
    308   # Some versions of the HPUX 10.20 sed can't process this invocation
    309   # correctly.  Breaking it into two sed invocations is a workaround.
    310   sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
    311     sed -e 's/$/ :/' >> "$depfile"
     323  # '$object: dependent.h' and one to simply 'dependent.h:'.
     324  sed -e "s/^[ $tab][ $tab]*/  /" -e "s,^[^:]*:,$object :," \
     325    < "$tmpdepfile" > "$depfile"
     326  sed '
     327    s/[ '"$tab"'][ '"$tab"']*/ /g
     328    s/^ *//
     329    s/ *\\*$//
     330    s/^[^:]*: *//
     331    /^$/d
     332    /:$/d
     333    s/$/ :/
     334  ' < "$tmpdepfile" >> "$depfile"
    312335  rm -f "$tmpdepfile"
    313336  ;;
     
    345368  if test -f "$tmpdepfile"; then
    346369    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
    347     # Add `dependent.h:' lines.
     370    # Add 'dependent.h:' lines.
    348371    sed -ne '2,${
    349372               s/^ *//
     
    360383tru64)
    361384   # The Tru64 compiler uses -MD to generate dependencies as a side
    362    # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
     385   # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
    363386   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
    364    # dependencies in `foo.d' instead, so we check for that too.
     387   # dependencies in 'foo.d' instead, so we check for that too.
    365388   # Subdirectories are respected.
    366389   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
     
    408431   if test -f "$tmpdepfile"; then
    409432      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
    410       # That's a tab and a space in the [].
    411       sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
     433      sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    412434   else
    413435      echo "#dummy" > "$depfile"
     
    444466}' | $cygpath_u | sort -u | sed -n '
    445467s/ /\\ /g
    446 s/\(.*\)/       \1 \\/p
     468s/\(.*\)/'"$tab"'\1 \\/p
    447469s/.\(.*\) \\/\1:/
    448470H
    449471$ {
    450   s/.*/ /
     472  s/.*/'"$tab"'/
    451473  G
    452474  p
     
    479501  fi
    480502
    481   # Remove `-o $object'.
     503  # Remove '-o $object'.
    482504  IFS=" "
    483505  for arg
     
    499521
    500522  test -z "$dashmflag" && dashmflag=-M
    501   # Require at least two characters before searching for `:'
     523  # Require at least two characters before searching for ':'
    502524  # in the target name.  This is to cope with DOS-style filenames:
    503   # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
     525  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
    504526  "$@" $dashmflag |
    505     sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
     527    sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
    506528  rm -f "$depfile"
    507529  cat < "$tmpdepfile" > "$depfile"
    508   tr ' ' '
    509 ' < "$tmpdepfile" | \
     530  tr ' ' "$nl" < "$tmpdepfile" | \
    510531## Some versions of the HPUX 10.20 sed can't process this invocation
    511532## correctly.  Breaking it into two sed invocations is a workaround.
     
    563584  # No need to regex-escape $object, excess matching of '.' is harmless.
    564585  sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
    565   sed '1,2d' "$tmpdepfile" | tr ' ' '
    566 ' | \
     586  sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
    567587## Some versions of the HPUX 10.20 sed can't process this invocation
    568588## correctly.  Breaking it into two sed invocations is a workaround.
     
    584604  fi
    585605
    586   # Remove `-o $object'.
     606  # Remove '-o $object'.
    587607  IFS=" "
    588608  for arg
     
    653673  rm -f "$depfile"
    654674  echo "$object : \\" > "$depfile"
    655   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::      \1 \\:p' >> "$depfile"
    656   echo "        " >> "$depfile"
     675  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
     676  echo "$tab" >> "$depfile"
    657677  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
    658678  rm -f "$tmpdepfile"
Note: See TracChangeset for help on using the changeset viewer.