You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

688 lines
20 KiB

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