make-w32
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mingw make problem


From: William A. Hoffman
Subject: Re: mingw make problem
Date: Fri, 18 Aug 2006 08:40:55 -0400

At 07:07 AM 8/18/2006, Eli Zaretskii wrote:
>> Date: Thu, 17 Aug 2006 21:37:37 -0400
>> From: "William A. Hoffman" <address@hidden>
>> 
>> >>Make 3.81 adds a feature whereby you can say "SHELL = cmd.exe" and
>> >>have it use CMD even if sh.exe is on your PATH.  Previous versions of
>> >>Make didn't allow even that.
>> >
>> >This behavior was controlled under the old Cygwin make via a --win32
>> >option (an option that RMS repeatedly asked me to change, FWIW).
>> >
>> >So, it sounds like one solution to the problem might be to just use
>> >SHELL=cmd.exe.
>> 
>> But I want it to use sh.exe.
>
>If this turns out to be some basic incompatibility between the quoting
>of native and Cygwin programs, you may have no other alternatives with
>the MinGW Make but use cmd.exe.  That is, unless someone debugs what
>happens in the Cygwin sh.exe end, and explains why this doesn't work
>for you, but does work for me with native ports.

Strange, If you look at the debug output I sent there is no shell redirection
going on, but sh is being used.   Here is a more simple case:

broken:
        c:/cygwin/bin/gcc.exe  "a.c" "b.c"
works:
        gcc.exe "a.c" "b.c"

works1:
        c:/cygwin/bin/gcc.exe a.c b.c

# sh used and it does not work with full path to gcc and quoted args
make broken -d
c:/cygwin/bin/gcc.exe  "a.c" "b.c"
CreateProcess(C:\cygwin\bin\sh.exe,C:/cygwin/bin/sh.exe -c 
"c:/cygwin/bin/gcc.exe  \"a.c\" \"b.c\"",...)

# sh used but it works if no full path to gcc
make works -d
gcc.exe "a.c" "b.c"
CreateProcess(C:\cygwin\bin\sh.exe,C:/cygwin/bin/sh.exe -c "gcc.exe \"a.c\" 
\"b.c\"",...)

# no sh used without the " around the file names
make works1 -d
c:/cygwin/bin/gcc.exe a.c b.c
CreateProcess(c:\cygwin\bin\gcc.exe,c:/cygwin/bin/gcc.exe a.c b.c,...)


So, it is the quotes that are causing it to use the shell.   There are some
really odd rules to CreateProcess.   I think CreateProcess is actually merging 
the strings and
passing them to the process.



>> The makefiles are mostly POSIX, the only non-POSIX thing in them is
>> the driver letter stuff.  C:/foo/bar.C.  So cmd.exe does not like
>> paths like that.
>
>File names like "C:/foo/bar.C" _will_ work with cmd.exe if you quote
>them with double quotes.  The Emacs build procedure on Windows uses
>this, and I have yet to hear about any problems.

Ok, so the issue is that for running commands from make all makes support
"/some/command".  However, many makes do not like quoted depend targets.

a: "/some/file"

So, CMake generates the \ escaped spaces uniformly.   I suppose we could
change it to do quotes for command launching and \ escapes for targets, but
then I would need to know if cmd or sh was going to be used when I generate
the makefile.   Since make picks that at run time, I can't pick.   It would
be nice if they worked the same, but they don't.


>> Also, cmd.exe has problems with long command lines.
>
>Every shell has command-line length limitations.
>
>Also, please note that GNU Make calls the shell only if the command
>has some special characters which require the shell, such as
>redirection.  Otherwise, Make invokes the program directly through
>CreateProcess, in which case the command length limitations are less
>severe.
>
>> MSYS make would be a good choice, but it has the bad habit of
>> changing command line options of dos programs into full paths to the
>> msys mount point.
>
>I think we already agreed that the best choice (for you) is to add
>support for DOS file names to the Cygwin Make 

Sure, but you wanted me to report the issue.  :) 
So, here it is....

BTW, this is the most current binary from mingw.
$ ./make.exe --version
GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.


-Bill





reply via email to

[Prev in Thread] Current Thread [Next in Thread]