Code afférent au projet Kouglof 2 de l'E2L
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.

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