Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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" Date: Tue, 14 Sep 2004 20:24:39 -0400 In-Reply-To: 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/