From 7a98106d9c1ec6a25ea69708a9d21f487535023e Mon Sep 17 00:00:00 2001 From: Peter Rosin Date: Tue, 3 Mar 2009 22:29:12 +0100 Subject: [PATCH] Add depmode=msvcmsys for Microsoft Visual C++ on MSYS. * lib/depcomp [msvisualcpp]: Fork fewer processes. Filter out libtool in the preprocessor invocation (as is done in depmode=cpp). Silence compiler stderr. [msvcmsys]: New depmode as a derivative of depmode=msvisualcpp. msvcmsys transforms any backslashes into forward slashes to make the grep in depend.m4 match, instead of the "cygpath -u" that is used in msvisualcpp. Signed-off-by: Ralf Wildenhues --- ChangeLog | 11 +++++++++++ lib/depcomp | 48 +++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 50 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index c347d1ba4..b82133d91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-03-03 Peter Rosin + + Add depmode=msvcmsys for Microsoft Visual C++ on MSYS. + * lib/depcomp [msvisualcpp]: Fork fewer processes. Filter out + libtool in the preprocessor invocation (as is done in + depmode=cpp). Silence compiler stderr. + [msvcmsys]: New depmode as a derivative of depmode=msvisualcpp. + msvcmsys transforms any backslashes into forward slashes to + make the grep in depend.m4 match, instead of the "cygpath -u" + that is used in msvisualcpp. + 2009-03-03 Ralf Wildenhues Peter Rosin diff --git a/lib/depcomp b/lib/depcomp index 0f2bf4303..47cf50ab3 100755 --- a/lib/depcomp +++ b/lib/depcomp @@ -1,10 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2007-03-29.01 +scriptversion=2009-03-03.11 -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software -# Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -85,6 +85,15 @@ if test "$depmode" = dashXmstdout; then depmode=dashmstdout fi +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what @@ -536,13 +545,27 @@ cpp) msvisualcpp) # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. + # always write the preprocessed file to stdout. "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + IFS=" " for arg do case "$arg" in + -o) + shift + ;; + $object) + shift + ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift @@ -555,16 +578,23 @@ msvisualcpp) ;; esac done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + none) exec "$@" ;; -- 2.47.2