Lines Matching +full:sub +full:- +full:spaces

2 # depcomp - compile a program generating dependencies as side-effects
4 scriptversion=2024-06-19.01; # UTC
6 # Copyright (C) 1999-2024 Free Software Foundation, Inc.
30 echo "$0: No command. Try '$0 --help' for more information." 1>&2
33 -h | --h*)
35 Usage: depcomp [--help] [--version] PROGRAM [ARGS]
38 as side-effects.
49 Report bugs to <bug-automake@gnu.org>.
55 -v | --v*)
67 */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
72 # Get the suffix-stripped basename of the given path, and save it the
76 base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
87 # Factor out some common post-processing of the generated depfile.
92 # post-process it.
93 if test -f "$tmpdepfile"; then
99 # which is needed to avoid the deleted-header problem.
100 { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
101 sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
103 rm -f "$tmpdepfile"
120 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
125 # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
126 depfile=${depfile-`echo "$object" |
127 sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
128 tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
130 rm -f "$tmpdepfile"
140 # HP compiler uses -M and no extra arg.
141 gccflag=-M
147 dashmflag=-xM
151 cygpath_u="cygpath -u -f -"
154 # Just convert the backslash-escaped backslashes to single forward
162 # Just convert the backslash-escaped backslashes to single forward
169 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
170 gccflag=-qmakedep=gcc,-MF
178 ## it if -MD -MP comes after the -MF stuff. Hmm.
186 -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
194 if test $stat -ne 0; then
195 rm -f "$tmpdepfile"
202 ## Note that this doesn't just cater to obsolete pre-3.x GCC compilers.
203 ## but also to in-use compilers like IBM xlc/xlC and the HP C compiler.
207 ## - Don't want to use -MD because we'd like the dependencies to end
210 ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
211 ## -MM, not -M (despite what the docs say). Also, it might not be
213 ## - Using -M directly means running the compiler twice (even worse
215 if test -z "$gccflag"; then
216 gccflag=-MD,
218 "$@" -Wp,"$gccflag$tmpdepfile"
220 if test $stat -ne 0; then
221 rm -f "$tmpdepfile"
224 rm -f "$depfile"
226 # The second -e expression handles DOS-style file names with drive
228 sed -e 's/^[^:]*: / /' \
229 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
243 | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
244 | sed -e 's/$/ :/' >> "$depfile"
245 rm -f "$tmpdepfile"
257 "$@" "-Wp,-MDupdate,$tmpdepfile"
259 "$@" -MDupdate "$tmpdepfile"
262 if test $stat -ne 0; then
263 rm -f "$tmpdepfile"
266 rm -f "$depfile"
268 if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
277 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
282 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
287 rm -f "$tmpdepfile"
298 # The C for AIX Compiler uses -M and outputs the dependencies
309 "$@" -Wc,-M
314 "$@" -M
317 if test $stat -ne 0; then
318 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
324 test -f "$tmpdepfile" && break
330 # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
342 # spaces rather than leading tabs (at least since its commit 0394caf7
343 # "Emit spaces for -MD").
344 "$@" -MD -MF "$tmpdepfile"
346 if test $stat -ne 0; then
347 rm -f "$tmpdepfile"
350 rm -f "$depfile"
351 # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
353 sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
355 # dummy dependency, to avoid the deleted-header problem.
356 sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
357 rm -f "$tmpdepfile"
362 ## listed in this file. A plain '-MD' option would be understood by many
365 # Portland's C compiler understands '-MD'.
370 # foo.o: sub/foo.c sub/foo.h
372 # foo.o: sub/foo.c ... \
373 # sub/foo.h ... \
385 lockdir=$base.d-lock
393 while test $i -gt 0; do
394 # mkdir is a portable test-and-set.
397 "$@" -MD
405 while test -d "$lockdir" && test $i -gt 0; do
407 i=`expr $i - 1`
410 i=`expr $i - 1`
412 trap - 1 2 13 15
413 if test $i -le 0; then
419 if test $stat -ne 0; then
420 rm -f "$tmpdepfile"
423 rm -f "$depfile"
432 | sed -e 's/$/ :/' >> "$depfile"
433 rm -f "$tmpdepfile"
448 "$@" -Wc,+Maked
455 if test $stat -ne 0; then
456 rm -f "$tmpdepfile1" "$tmpdepfile2"
462 test -f "$tmpdepfile" && break
464 if test -f "$tmpdepfile"; then
465 sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
467 sed -ne '2,${
476 rm -f "$tmpdepfile" "$tmpdepfile2"
480 # The Tru64 compiler uses -MD to generate dependencies as a side
481 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
482 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
498 tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
499 "$@" -Wc,-MD
504 "$@" -MD
508 if test $stat -ne 0; then
509 rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
515 test -f "$tmpdepfile" && break
517 # Same post-processing that is required for AIX mode.
523 showIncludes=-Wc,-showIncludes
525 showIncludes=-showIncludes
529 grep -v '^Note: including file: ' "$tmpdepfile"
530 if test $stat -ne 0; then
531 rm -f "$tmpdepfile"
534 rm -f "$depfile"
541 sed < "$tmpdepfile" -n '
546 }' | $cygpath_u | sort -u | sed -n '
557 rm -f "$tmpdepfile"
568 # This comment above is used by automake to tell side-effect
573 # always write the preprocessed file to stdout, regardless of -o.
578 while test "X$1" != 'X--mode=compile'; do
584 # Remove '-o $object'.
589 -o)
603 test -z "$dashmflag" && dashmflag=-M
605 # in the target name. This is to cope with DOS-style filenames:
609 rm -f "$depfile"
614 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
615 | sed -e 's/$/ :/' >> "$depfile"
616 rm -f "$tmpdepfile"
629 while test "X$1" != 'X--mode=compile'; do
649 -D*|-I*)
653 -arch)
655 -*|$object)
663 ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
664 rm -f "$depfile"
666 # No need to regex-escape $object, excess matching of '.' is harmless.
672 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
673 | sed -e 's/$/ :/' >> "$depfile"
674 rm -f "$tmpdepfile" "$tmpdepfile".bak
684 while test "X$1" != 'X--mode=compile'; do
690 # Remove '-o $object'.
695 -o)
709 "$@" -E \
710 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
711 -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
713 rm -f "$depfile"
717 rm -f "$tmpdepfile"
727 while test "X$1" != 'X--mode=compile'; do
737 -o)
743 "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
755 "$@" -E 2>/dev/null |
756 sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
757 rm -f "$depfile"
759 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
761 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
762 rm -f "$tmpdepfile"
785 # mode: shell-script
786 # sh-indentation: 2
787 # eval: (add-hook 'before-save-hook 'time-stamp)
788 # time-stamp-start: "scriptversion="
789 # time-stamp-format: "%:y-%02m-%02d.%02H"
790 # time-stamp-time-zone: "UTC0"
791 # time-stamp-end: "; # UTC"