This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bizarre behaviour of "make --win32"

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?


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]