annotate depcomp @ 359:3dfa93d65701

Added tag stable-6-0-48 for changeset ef7479b2d64f
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jan 2017 08:28:37 -0800
parents 9978e29c4d71
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
109
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
1 #! /bin/sh
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
2 # depcomp - compile a program generating dependencies as side-effects
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
3
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
4 scriptversion=2004-05-31.23
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
5
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
6 # Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
7
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
8 # This program is free software; you can redistribute it and/or modify
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
9 # it under the terms of the GNU General Public License as published by
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
10 # the Free Software Foundation; either version 2, or (at your option)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
11 # any later version.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
12
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
13 # This program is distributed in the hope that it will be useful,
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
16 # GNU General Public License for more details.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
17
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
18 # You should have received a copy of the GNU General Public License
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
19 # along with this program; if not, write to the Free Software
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
21 # 02111-1307, USA.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
22
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
23 # As a special exception to the GNU General Public License, if you
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
24 # distribute this file as part of a program that contains a
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
25 # configuration script generated by Autoconf, you may include it under
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
26 # the same distribution terms that you use for the rest of that program.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
27
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
28 # Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
29
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
30 case $1 in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
31 '')
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
32 echo "$0: No command. Try \`$0 --help' for more information." 1>&2
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
33 exit 1;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
34 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
35 -h | --h*)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
36 cat <<\EOF
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
37 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
38
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
39 Run PROGRAMS ARGS to compile a file, generating dependencies
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
40 as side-effects.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
41
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
42 Environment variables:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
43 depmode Dependency tracking mode.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
44 source Source file read by `PROGRAMS ARGS'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
45 object Object file output by `PROGRAMS ARGS'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
46 DEPDIR directory where to store dependencies.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
47 depfile Dependency file to output.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
48 tmpdepfile Temporary file to use when outputing dependencies.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
49 libtool Whether libtool is used (yes/no).
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
50
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
51 Report bugs to <bug-automake@gnu.org>.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
52 EOF
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
53 exit 0
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
54 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
55 -v | --v*)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
56 echo "depcomp $scriptversion"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
57 exit 0
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
58 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
59 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
60
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
61 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
62 echo "depcomp: Variables source, object and depmode must be set" 1>&2
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
63 exit 1
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
64 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
65
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
66 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
67 depfile=${depfile-`echo "$object" |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
68 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
69 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
70
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
71 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
72
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
73 # Some modes work just like other modes, but use different flags. We
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
74 # parameterize here, but still list the modes in the big case below,
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
75 # to make depend.m4 easier to write. Note that we *cannot* use a case
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
76 # here, because this file can only contain one case statement.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
77 if test "$depmode" = hp; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
78 # HP compiler uses -M and no extra arg.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
79 gccflag=-M
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
80 depmode=gcc
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
81 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
82
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
83 if test "$depmode" = dashXmstdout; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
84 # This is just like dashmstdout with a different argument.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
85 dashmflag=-xM
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
86 depmode=dashmstdout
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
87 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
88
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
89 case "$depmode" in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
90 gcc3)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
91 ## gcc 3 implements dependency tracking that does exactly what
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
92 ## we want. Yay! Note: for some reason libtool 1.4 doesn't like
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
93 ## it if -MD -MP comes after the -MF stuff. Hmm.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
94 "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
95 stat=$?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
96 if test $stat -eq 0; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
97 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
98 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
99 exit $stat
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
100 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
101 mv "$tmpdepfile" "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
102 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
103
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
104 gcc)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
105 ## There are various ways to get dependency output from gcc. Here's
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
106 ## why we pick this rather obscure method:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
107 ## - Don't want to use -MD because we'd like the dependencies to end
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
108 ## up in a subdir. Having to rename by hand is ugly.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
109 ## (We might end up doing this anyway to support other compilers.)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
110 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
111 ## -MM, not -M (despite what the docs say).
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
112 ## - Using -M directly means running the compiler twice (even worse
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
113 ## than renaming).
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
114 if test -z "$gccflag"; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
115 gccflag=-MD,
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
116 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
117 "$@" -Wp,"$gccflag$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
118 stat=$?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
119 if test $stat -eq 0; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
120 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
121 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
122 exit $stat
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
123 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
124 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
125 echo "$object : \\" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
126 alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
127 ## The second -e expression handles DOS-style file names with drive letters.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
128 sed -e 's/^[^:]*: / /' \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
129 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
130 ## This next piece of magic avoids the `deleted header file' problem.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
131 ## The problem is that when a header file which appears in a .P file
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
132 ## is deleted, the dependency causes make to die (because there is
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
133 ## typically no way to rebuild the header). We avoid this by adding
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
134 ## dummy dependencies for each header file. Too bad gcc doesn't do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
135 ## this for us directly.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
136 tr ' ' '
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
137 ' < "$tmpdepfile" |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
138 ## Some versions of gcc put a space before the `:'. On the theory
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
139 ## that the space means something, we add a space to the output as
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
140 ## well.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
141 ## Some versions of the HPUX 10.20 sed can't process this invocation
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
142 ## correctly. Breaking it into two sed invocations is a workaround.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
143 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
144 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
145 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
146
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
147 hp)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
148 # This case exists only to let depend.m4 do its work. It works by
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
149 # looking at the text of this script. This case will never be run,
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
150 # since it is checked for above.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
151 exit 1
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
152 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
153
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
154 sgi)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
155 if test "$libtool" = yes; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
156 "$@" "-Wp,-MDupdate,$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
157 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
158 "$@" -MDupdate "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
159 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
160 stat=$?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
161 if test $stat -eq 0; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
162 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
163 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
164 exit $stat
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
165 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
166 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
167
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
168 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
169 echo "$object : \\" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
170
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
171 # Clip off the initial element (the dependent). Don't try to be
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
172 # clever and replace this with sed code, as IRIX sed won't handle
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
173 # lines with more than a fixed number of characters (4096 in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
174 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
175 # the IRIX cc adds comments like `#:fec' to the end of the
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
176 # dependency line.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
177 tr ' ' '
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
178 ' < "$tmpdepfile" \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
179 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
180 tr '
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
181 ' ' ' >> $depfile
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
182 echo >> $depfile
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
183
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
184 # The second pass generates a dummy entry for each header file.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
185 tr ' ' '
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
186 ' < "$tmpdepfile" \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
187 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
188 >> $depfile
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
189 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
190 # The sourcefile does not contain any dependencies, so just
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
191 # store a dummy comment line, to avoid errors with the Makefile
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
192 # "include basename.Plo" scheme.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
193 echo "#dummy" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
194 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
195 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
196 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
197
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
198 aix)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
199 # The C for AIX Compiler uses -M and outputs the dependencies
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
200 # in a .u file. In older versions, this file always lives in the
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
201 # current directory. Also, the AIX compiler puts `$object:' at the
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
202 # start of each line; $object doesn't have directory information.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
203 # Version 6 uses the directory in both cases.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
204 stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
205 tmpdepfile="$stripped.u"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
206 if test "$libtool" = yes; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
207 "$@" -Wc,-M
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
208 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
209 "$@" -M
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
210 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
211 stat=$?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
212
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
213 if test -f "$tmpdepfile"; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
214 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
215 stripped=`echo "$stripped" | sed 's,^.*/,,'`
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
216 tmpdepfile="$stripped.u"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
217 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
218
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
219 if test $stat -eq 0; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
220 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
221 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
222 exit $stat
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
223 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
224
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
225 if test -f "$tmpdepfile"; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
226 outname="$stripped.o"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
227 # Each line is of the form `foo.o: dependent.h'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
228 # Do two passes, one to just change these to
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
229 # `$object: dependent.h' and one to simply `dependent.h:'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
230 sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
231 sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
232 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
233 # The sourcefile does not contain any dependencies, so just
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
234 # store a dummy comment line, to avoid errors with the Makefile
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
235 # "include basename.Plo" scheme.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
236 echo "#dummy" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
237 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
238 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
239 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
240
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
241 icc)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
242 # Intel's C compiler understands `-MD -MF file'. However on
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
243 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
244 # ICC 7.0 will fill foo.d with something like
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
245 # foo.o: sub/foo.c
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
246 # foo.o: sub/foo.h
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
247 # which is wrong. We want:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
248 # sub/foo.o: sub/foo.c
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
249 # sub/foo.o: sub/foo.h
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
250 # sub/foo.c:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
251 # sub/foo.h:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
252 # ICC 7.1 will output
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
253 # foo.o: sub/foo.c sub/foo.h
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
254 # and will wrap long lines using \ :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
255 # foo.o: sub/foo.c ... \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
256 # sub/foo.h ... \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
257 # ...
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
258
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
259 "$@" -MD -MF "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
260 stat=$?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
261 if test $stat -eq 0; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
262 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
263 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
264 exit $stat
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
265 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
266 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
267 # Each line is of the form `foo.o: dependent.h',
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
268 # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
269 # Do two passes, one to just change these to
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
270 # `$object: dependent.h' and one to simply `dependent.h:'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
271 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
272 # Some versions of the HPUX 10.20 sed can't process this invocation
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
273 # correctly. Breaking it into two sed invocations is a workaround.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
274 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
275 sed -e 's/$/ :/' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
276 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
277 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
278
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
279 tru64)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
280 # The Tru64 compiler uses -MD to generate dependencies as a side
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
281 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
282 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
283 # dependencies in `foo.d' instead, so we check for that too.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
284 # Subdirectories are respected.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
285 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
286 test "x$dir" = "x$object" && dir=
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
287 base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
288
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
289 if test "$libtool" = yes; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
290 # Dependencies are output in .lo.d with libtool 1.4.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
291 # With libtool 1.5 they are output both in $dir.libs/$base.o.d
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
292 # and in $dir.libs/$base.o.d and $dir$base.o.d. We process the
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
293 # latter, because the former will be cleaned when $dir.libs is
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
294 # erased.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
295 tmpdepfile1="$dir.libs/$base.lo.d"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
296 tmpdepfile2="$dir$base.o.d"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
297 tmpdepfile3="$dir.libs/$base.d"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
298 "$@" -Wc,-MD
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
299 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
300 tmpdepfile1="$dir$base.o.d"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
301 tmpdepfile2="$dir$base.d"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
302 tmpdepfile3="$dir$base.d"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
303 "$@" -MD
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
304 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
305
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
306 stat=$?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
307 if test $stat -eq 0; then :
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
308 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
309 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
310 exit $stat
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
311 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
312
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
313 if test -f "$tmpdepfile1"; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
314 tmpdepfile="$tmpdepfile1"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
315 elif test -f "$tmpdepfile2"; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
316 tmpdepfile="$tmpdepfile2"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
317 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
318 tmpdepfile="$tmpdepfile3"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
319 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
320 if test -f "$tmpdepfile"; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
321 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
322 # That's a tab and a space in the [].
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
323 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
324 else
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
325 echo "#dummy" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
326 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
327 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
328 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
329
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
330 #nosideeffect)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
331 # This comment above is used by automake to tell side-effect
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
332 # dependency tracking mechanisms from slower ones.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
333
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
334 dashmstdout)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
335 # Important note: in order to support this mode, a compiler *must*
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
336 # always write the preprocessed file to stdout, regardless of -o.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
337 "$@" || exit $?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
338
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
339 # Remove the call to Libtool.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
340 if test "$libtool" = yes; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
341 while test $1 != '--mode=compile'; do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
342 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
343 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
344 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
345 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
346
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
347 # Remove `-o $object'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
348 IFS=" "
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
349 for arg
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
350 do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
351 case $arg in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
352 -o)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
353 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
354 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
355 $object)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
356 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
357 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
358 *)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
359 set fnord "$@" "$arg"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
360 shift # fnord
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
361 shift # $arg
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
362 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
363 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
364 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
365
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
366 test -z "$dashmflag" && dashmflag=-M
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
367 # Require at least two characters before searching for `:'
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
368 # in the target name. This is to cope with DOS-style filenames:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
369 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
370 "$@" $dashmflag |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
371 sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
372 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
373 cat < "$tmpdepfile" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
374 tr ' ' '
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
375 ' < "$tmpdepfile" | \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
376 ## Some versions of the HPUX 10.20 sed can't process this invocation
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
377 ## correctly. Breaking it into two sed invocations is a workaround.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
378 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
379 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
380 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
381
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
382 dashXmstdout)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
383 # This case only exists to satisfy depend.m4. It is never actually
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
384 # run, as this mode is specially recognized in the preamble.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
385 exit 1
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
386 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
387
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
388 makedepend)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
389 "$@" || exit $?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
390 # Remove any Libtool call
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
391 if test "$libtool" = yes; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
392 while test $1 != '--mode=compile'; do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
393 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
394 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
395 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
396 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
397 # X makedepend
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
398 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
399 cleared=no
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
400 for arg in "$@"; do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
401 case $cleared in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
402 no)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
403 set ""; shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
404 cleared=yes ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
405 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
406 case "$arg" in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
407 -D*|-I*)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
408 set fnord "$@" "$arg"; shift ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
409 # Strip any option that makedepend may not understand. Remove
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
410 # the object too, otherwise makedepend will parse it as a source file.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
411 -*|$object)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
412 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
413 *)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
414 set fnord "$@" "$arg"; shift ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
415 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
416 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
417 obj_suffix="`echo $object | sed 's/^.*\././'`"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
418 touch "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
419 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
420 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
421 cat < "$tmpdepfile" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
422 sed '1,2d' "$tmpdepfile" | tr ' ' '
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
423 ' | \
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
424 ## Some versions of the HPUX 10.20 sed can't process this invocation
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
425 ## correctly. Breaking it into two sed invocations is a workaround.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
426 sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
427 rm -f "$tmpdepfile" "$tmpdepfile".bak
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
428 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
429
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
430 cpp)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
431 # Important note: in order to support this mode, a compiler *must*
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
432 # always write the preprocessed file to stdout.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
433 "$@" || exit $?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
434
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
435 # Remove the call to Libtool.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
436 if test "$libtool" = yes; then
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
437 while test $1 != '--mode=compile'; do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
438 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
439 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
440 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
441 fi
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
442
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
443 # Remove `-o $object'.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
444 IFS=" "
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
445 for arg
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
446 do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
447 case $arg in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
448 -o)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
449 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
450 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
451 $object)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
452 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
453 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
454 *)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
455 set fnord "$@" "$arg"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
456 shift # fnord
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
457 shift # $arg
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
458 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
459 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
460 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
461
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
462 "$@" -E |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
463 sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
464 sed '$ s: \\$::' > "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
465 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
466 echo "$object : \\" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
467 cat < "$tmpdepfile" >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
468 sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
469 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
470 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
471
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
472 msvisualcpp)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
473 # Important note: in order to support this mode, a compiler *must*
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
474 # always write the preprocessed file to stdout, regardless of -o,
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
475 # because we must use -o when running libtool.
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
476 "$@" || exit $?
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
477 IFS=" "
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
478 for arg
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
479 do
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
480 case "$arg" in
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
481 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
482 set fnord "$@"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
483 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
484 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
485 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
486 *)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
487 set fnord "$@" "$arg"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
488 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
489 shift
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
490 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
491 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
492 done
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
493 "$@" -E |
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
494 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
495 rm -f "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
496 echo "$object : \\" > "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
497 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
498 echo " " >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
499 . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
500 rm -f "$tmpdepfile"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
501 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
502
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
503 none)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
504 exec "$@"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
505 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
506
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
507 *)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
508 echo "Unknown depmode $depmode" 1>&2
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
509 exit 1
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
510 ;;
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
511 esac
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
512
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
513 exit 0
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
514
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
515 # Local Variables:
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
516 # mode: shell-script
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
517 # sh-indentation: 2
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
518 # eval: (add-hook 'write-file-hooks 'time-stamp)
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
519 # time-stamp-start: "scriptversion="
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
520 # time-stamp-format: "%:y-%02m-%02d.%02H"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
521 # time-stamp-end: "$"
9978e29c4d71 move to autoconf/automake/docbook
carl
parents:
diff changeset
522 # End: