depcomp revision 7c478bd95313f5f23a4c958a745db2134aa03244
0N/A# depcomp - compile a program generating dependencies as side-effects 0N/A# Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. 0N/A# This program is free software; you can redistribute it and/or modify 0N/A# it under the terms of the GNU General Public License as published by 0N/A# the Free Software Foundation; either version 2, or (at your option) 0N/A# This program is distributed in the hope that it will be useful, 0N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 0N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0N/A# GNU General Public License for more details. 0N/A# You should have received a copy of the GNU General Public License 457N/A# along with this program; if not, write to the Free Software 0N/A# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 1190N/A# As a special exception to the GNU General Public License, if you 0N/A# distribute this file as part of a program that contains a 0N/A# configuration script generated by Autoconf, you may include it under 0N/A# the same distribution terms that you use for the rest of that program. 0N/A# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. 0N/A echo "$0: No command. Try \`$0 --help' for more information." 1>&
2 1190N/A object Object file output by `PROGRAMS ARGS'. 1190N/A echo "depcomp: Variables source, object and depmode must be set" 1>&2 0N/A# `libtool' can also be set to `yes' or `no'. 0N/A # FIXME: should be _deps on DOS. 0N/A# Some modes work just like other modes, but use different flags. We 1190N/A# parameterize here, but still list the modes in the big case below, 0N/A# to make depend.m4 easier to write. Note that we *cannot* use a case 0N/A# here, because this file can only contain one case statement. 1190N/A # HP compiler uses -M and no extra arg. 0N/A # This is just like dashmstdout with a different argument. 0N/A## gcc 3 implements dependency tracking that does exactly what 0N/A## we want. Yay! Note: for some reason libtool 1.4 doesn't like 1185N/A## it if -MD -MP comes after the -MF stuff. Hmm. ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## The second -e expression handles DOS-style file names with drive letters. ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ # The second pass generates a dummy entry for each header file. | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. # Do two passes, one to just change these to # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # Intel's C compiler understands `-MD -MF file'. However on # ICC 7.0 will fill foo.d with something like # which is wrong. We want: # and will wrap long lines using \ : # Do two passes, one to just change these to # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. base=`echo "$object" |
sed -e
's|^.*/||' -e
's/\.o$//' -e
's/\.lo$//'` # That's a tab and a space in the []. # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. # Remove the call to Libtool. while test $1 != '--mode=compile'; do # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. # Remove any Libtool call while test $1 != '--mode=compile'; do # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. # Remove the call to Libtool. while test $1 != '--mode=compile'; do sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H"