[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to output newline at the end of making a target (on Windows)
From: |
Paul Smith |
Subject: |
Re: how to output newline at the end of making a target (on Windows) |
Date: |
Sun, 29 Nov 2009 18:06:01 -0500 |
On Sun, 2009-11-29 at 14:30 -0800, Mark Galeck (CW) wrote:
> Hello,
>
> SHELL=cmd.exe
> foobar:
> @echo.
>
> gives me:
> C:\tmp>make foobar
> process_begin: CreateProcess(NULL, echo., ...) failed.
> make (e=2): The system cannot find the file specified.
> make: *** [foobar] Error 2
>
>
> However, I do use "echo." process all the time on Windows, just
> outputting to a file - this works perfectly fine:
>
> SHELL=cmd.exe
> foobar:
> @echo.>foo
>
> and
> C:\tmp>make foobar
> works fine, foo gets a newline (no errors either in foo or on standard
> out).
>
> Why is this so??
This is really a Windows-specific question so it will be more likely to
be answered accurately if you ask on the address@hidden mailing list.
However, I'd guess that this is due to make's fast path processing: if
make can determine that the command you're invoking does not need a
shell, it won't start one; instead it will simply try to invoke the
command directly.
In this case, the command "echo." is not known to make as a command that
requires a shell, so it tries to run it directly. In reality this is
not a real command but rather a builtin command for the Windows shell
(for example command.com), so trying to invoke it directly fails.
On the other hand, when you run "echo.>foo" make sees the redirection
(">") and understands that this is not a simple command and can't be run
using the fast path, so it invokes the shell to run it and it works.
Make knows the command "echo" is a shell builtin, but not "echo.".
Someone else will need to judge whether "echo." should be added as a
builtin, or whether something else should be done.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist