bug-make
[Top][All Lists]
Advanced

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

Re: Unexpected feature


From: Paul Smith
Subject: Re: Unexpected feature
Date: Thu, 20 Mar 2008 16:38:07 -0400

On Thu, 2008-03-20 at 09:24 -0700, Gert Jan van Loo wrote:
> I assume this 'feature' will not be removed as it will break the
> makefile of all simple souls who are not competent enough to add a
> space in the right place.

Actually, it won't be removed because to do so would contravene the
POSIX standard for "make", which requires:

>         When an escaped <newline> (one preceded by a backslash) is
>         found anywhere in the makefile except in a command line, it
>         shall be replaced, along with any leading white space on the
>         following line, with a single <space>. When an escaped
>         <newline> is found in a command line in a makefile, the
>         command line shall contain the backslash, the <newline>, and
>         the next line, except that the first character of the next
>         line shall not be included if it is a <tab>.

To the best of my knowledge, GNU make implements this behavior exactly.

> I DO suggest to add this to the manual somewhere and explain in more
> details the processing which takes place when a backslash is at the
> end of a line: It adds one space if it is missing and it reduces
> multiple spaces and tabs to a single space.

There's a whole section dedicated to backslash/newline handling in
recipes, but you're right, there's nothing explicitly said about how
whitespace is handled outside of recipes.

> I also suggest you specify how to get rid of these nasty spaces in
> case anybody does not want them.

Erm... don't use backslash/newline in those situations, but just write
the string as one long line?

I'm not aware of any other robust way to avoid the problem.


Cheers!

-- 
-----------------------------------------------------------------------------
 Paul D. Smith <address@hidden>                 http://make.mad-scientist.us
 "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]