annotate depcomp @ 2:bb3f804f13a0

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