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