annotate depcomp @ 59:7d5c637aaafb

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