bugmake - Bugs: bug #54116, Extend documentation for...

 
 

bug #54116: Extend documentation for space-free line continuation techniques

Submitter:  Michael Henry <drmikehenry>
Submitted:  Thu 14 Jun 2018 04:44:07 PM UTC
   
 
Severity:  3 - Normal Item Group:  Documentation
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  None Operating System:  None
Fixed Release:  4.3 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 21 May 2019 11:17:27 PM UTC, comment #2: 

Thanks; I feel better using this technique knowing that it's officially supported :-)

Michael Henry <drmikehenry>
Sun 19 May 2019 11:49:07 PM UTC, comment #1: 

I added some documentation and a test to ensure it stays valid.

I only documented the basic technique, not the second technique with post-processing.  I'm not sure that's appropriate for the user manual.  Maybe that should go somewhere else for "tips and tricks".

Paul D. Smith <psmith>
Group administrator
Thu 14 Jun 2018 04:44:07 PM UTC, original submission:  

Line continuations via backslash/newline result in the insertion
of a single space character that often causes problems.  I've
discovered a method for suppressing that space which has low
syntactic overhead and is compatible with GNU Make versions as
far back as I can conveniently find.  I'd like to propose some
additions to GNU Make's documentation that demonstrate the
technique.  I've placed my suggestions on Github here:
https://github.com/drmikehenry/make
I've also attached a diff to this ticket.

There are two techniques documented in the repository above.
First, instead of using backslash/newline for line
continuations, use dollar sign/backslash/newline.  After each
backslash-newline has been replaced with a single space, this
leaves dollar sign/space pairs which syntactically expand the
single-character variable named <space>; as that variable is not
defined by default, these pairs evaporate to the empty string.
As a simple example, this:


  x := one$\
       word


is equivalent to this:


  x := oneword


In addition, I've documented a second technique for handling
line continuations.  It involves post-processing a multiline
variable to remove newlines and indentation as a way of avoiding
the problems of the injected space character.  This method
requires GNU Make 3.80 or later because it uses $(eval) and
$(value), but it results in very readable user-defined
functions.

I've also included a small unit test to help ensure that no
future version of GNU Make will throw warnings or errors when
evaluating the single-character variable named <space>.

My main hope is to ensure that GNU Make does not change in the
future in a way that would break the dollar
sign/backslash/newline technique.  Thanks for your
consideration.

Michael Henry

Michael Henry <drmikehenry>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #44369:  make.diff added by drmikehenry (5KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by drmikehenry (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-19 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.3
    2018-06-14 drmikehenry Attached File- Added make.diff, #44369

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code