delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/14/20:24:48

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: "Bob Byrnes" <byrnes AT curl DOT com>
Date: Tue, 14 Sep 2004 20:24:39 -0400
In-Reply-To: <NUTMEGTml7wul79q1M20000139b@NUTMEG.CAM.ARTIMI.COM> from "Dave Korn" (Sep 14, 4:01pm)
Organization: Curl Corporation
X-Address: 1 Cambridge Center, 10th Floor, Cambridge, MA 02142-1612
X-Phone: 617-761-1238
X-Fax: 617-761-1201
To: cygwin AT cygwin DOT com
Subject: Re: Bizarre behaviour of "make --win32"
Message-Id: <20040915002439.27FBDE538@carnage.curl.com>

On Sep 14,  4:01pm, Dave Korn wrote:
-- Subject: Bizarre behaviour of "make --win32"
>
> It appears to be using sh.exe, regardless of the --win32 flag.  But if I
> add stdout redirection to the command in question, it uses cmd.exe.
> 
-- End of excerpt from "Dave Korn"

On non-Cygwin, UNIX platforms, GNU make will optimize away the shell
invocation for simple commands, which are identified by lack of known
shell metacharacters (like ">").  For example, "foo bar baz" would be
executed directly, using something like execvp(), but "foo bar > baz"
would run /bin/sh -c "foo bar > baz".

If the Makefile sets the SHELL make variable to something other than
the default /bin/sh, then this opimization is disabled: GNU make
conservatively assumes that it has no idea about the syntax for the
nonstandard shell, ignores potential metacharacters, and just always
runs $(SHELL) -c "command".  This can have performance implications,
as you might imagine.

I don't know offhand what happens with --win32, but the difference in
behavior with stdout redirection that you report is probably related
to this optimization.  I thought --win32 was supposed to use cmd.exe,
but I don't know what the equivalent of execvp() would be for simple
commands, or if make --win32 knows about cmd.exe metacharacters.
What makes you think that sh.exe is being used?

--
Bob

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019