#!/bin/sh pathname_separator=/ original_command="$*" filter_sed="-n" while test x"$1" != x do case $1 in --convert-string ) shift var_src=`echo $1 | sed 's/=.*//'` var_dst=`echo $1 | sed 's/^.*=//'` if test x != "x${var_src}" -a x != "x${var_dst}" then convert_string_sed="${convert_string_sed} -e s|"${var_src}"|"${var_dst}"|g" fi shift ;; -o ) shift output=$1 shift ;; *) basename_in_opt=`basename ${pathname_separator}$1` filter_sed="${filter_sed} -e /\\${pathname_separator}${basename_in_opt}$/p " command_without_o="${command_without_o} $1" shift ;; esac done TMPFILE_in=`mktemp ${TMPDIR-/tmp}/make-cc-dep.XXXXXX` \ || ( echo "$0: Can't create temp file, exiting..." 1>&2 && exit 1 ) TMPFILE_out=`mktemp ${TMPDIR-/tmp}/make-cc-dep.XXXXXX` \ || ( echo "$0: Can't create temp file, exiting..." 1>&2 && exit 1 ) ${command_without_o} -M -o ${TMPFILE_in} sed < ${TMPFILE_in} > ${TMPFILE_out} '1s/^.*: //;s/ *\\$//' cp ${TMPFILE_out} ${TMPFILE_in} sed < ${TMPFILE_in} > ${TMPFILE_out} ${filter_sed} cp ${TMPFILE_out} ${TMPFILE_in} if test x != x"${convert_string_sed}" then sed < ${TMPFILE_in} > ${TMPFILE_out} ${convert_string_sed} cp ${TMPFILE_out} ${TMPFILE_in} fi echo > ${TMPFILE_out} "#!/bin/sh" echo >> ${TMPFILE_out} "# ${original_command}" if test x != x"${convert_string_sed}" then echo echo "'"${output}: | sed ${convert_string_sed} | tr '\n' ' ' >> ${TMPFILE_out} else echo echo "'"${output}: | tr '\n' ' ' >> ${TMPFILE_out} fi tr '\n' ' ' < ${TMPFILE_in} | sed "s/ *$/'/" >> ${TMPFILE_out} cp ${TMPFILE_out} ${TMPFILE_in} sed "/^[^#]/s/ */ /g" < ${TMPFILE_in} > ${output} rm -f ${TMPFILE_in} ${TMPFILE_out}