make-w32
[Top][All Lists]
Advanced

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

Re: Problem with backslash/newline on DOS/Windows/OS2/etc.?


From: Paul D. Smith
Subject: Re: Problem with backslash/newline on DOS/Windows/OS2/etc.?
Date: Thu, 7 Jul 2005 16:16:17 -0400

%% Eli Zaretskii <address@hidden> writes:

  >> and verified whether some kind of special case needs to be made for
  >> those platforms, perhaps when make detects we're not using a UNIX-y
  >> shell or something?

  ez> There should be no need for anything special.  The ported Make on
  ez> these platforms reads (or at least should read) Makefile's in text
  ez> mode, so what you have in memory is the same content as on Unix:
  ez> each line ends with a single newline character, \n.

  ez> The only issue here might be with commands that have embedded
  ez> newlines: DOS/Windows shells don't support that, AFAIK.  But I
  ez> don't think this is relevant to the issue at hand.

No, I'm talking about something different here.

In previous version of make, make would do all the backslash-newline
handling for you before invoking the shell, regardless of what shell was
being invoked (for the purposes of this discussion we'll consider the
slow path only, although of course the fast path has to behave
identically to what the shell would do).

So for example, if you had a rule like this:

        echo foo \
bar

then make would compress the backslash newline for you and it would
actually exec something like (again, pretend there's no fast path):

    $(SHELL) -c 'echo foo bar'


After this change, and according to POSIX, that's not how make is
supposed to work.  Make is supposed to preserve the backslash-newline
and hand it over to the shell, and let the _shell_ deal with it.  So,
after this change make runs this command:

    $(SHELL) -c 'echo foo \
bar'


Now, in UNIX this largely behaves the same in the end anyway, since the
shell's rules for backslash-newline handling are similar to make's, but
there are important situations where this behavior does make a big
difference (in fact, I was able to close at least two other bugs and,
IIRC, a support request by implementing this because it means you can
keep newlines in your shell scripts).

But, in DOS/Windows/OS2 I'm not so sanguine about the impacts... so I'd
like folks to give this a try.


Checking out the scripts/misc/general3 regression test suite, which is
where I put all the tests for this, would be a good start.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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