annotate depcomp @ 0:cb178e5ad177 trunk

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