[Top][All Lists]

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

Re: make and backslash-newline's

From: Paul D. Smith
Subject: Re: make and backslash-newline's
Date: Tue, 27 Dec 2005 22:06:31 -0500

%% "Alfred M\. Szmidt" <address@hidden> writes:

  ams> Please revert the POSIX_ME_HARDER change of backslash-newline
  ams> sequences are handled.  There is absolutley no reason to break
  ams> this.  Lots of old Makefile use it, and so do many new ones.  If
  ams> one wishes to follow POSIX, one can make this the default setting
  ams> when POSIX_ME_HARDER (usually known as POSIXLY_CORRECT) is set or
  ams> a extra option, --posix.  GNU Make is after all not POSIX make.


At this point I'm not considering backing out this change.  First, GNU
make absolutely _IS_ an implementation of POSIX standard for make: you
only have to read as far as the second paragraph in the GNU make manual:

> GNU make conforms to section 6.2 of IEEE Standard 1003.2-1992 (POSIX.2).

Second, the change is limited to two specific areas: one is
backslash/newline inside single-quoted strings, and the other is if
there is no space before a backslash/newline and either nothing or only
a TAB before text on the next line.  I accept that some people may have
a few of these, and a few people may have a lot of them, but the vast
majority of makefiles do not have either of these situations.

Third, various other versions of make, including all versions based on
SysV make (Solaris, AIX, HP-UX, etc.), behave the POSIX way as well:
this is not something unique to GNU make.

Fourth, while the new method does require some changes to make it work
with backslashes inside single-quoted arguments (as described in
previous threads), the old method simply cannot be made to work in
situations where it is required to have a newline in the script (various
types of sed scripts in particular, but definitely not exclusively):
there is absolutely no way to get a newline character into a script.
You are forced to do odd things like echo individual lines in a subshell
and pipe the whole thing into another shell... horrible, utterly
unmaintainable stuff.  So, the new method is more flexible than the old

Fifth, the POSIX behavior makes sense (to me): any command scripts in
the makefile behave identically to the way the command would behave if
you typed it into a shell prompt, character for character.

Finally, I understand your position about making this change in behavior
only when POSIX mode is enabled (using the .POSIX: pseudo-target).
However, I intensely dislike having options to change basic capabilities
like this: multiple modes increases the amount of testing exponentially
as you have to test all different combinations.  Currently there's
virtually no difference between "POSIX mode" and "normal mode", and I
definitely want to keep it that way as much as humanly possible.  I
don't believe there is enough value in keeping the old behavior as an
option, given all the difficulty, overhead, and confusion that entails.

I do agree with others that the change and new behavior and ways to work
with it are not well-covered in the docs so I'll definitely work on that.

 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]