help-make
[Top][All Lists]
Advanced

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

Re: Disambiguating # within commands


From: Soren A
Subject: Re: Disambiguating # within commands
Date: Sun, 1 Sep 2002 19:16:15 +0000 (UTC)
User-agent: Xnews/5.04.25

Trevor Jenkins <address@hidden> wrote in
news:address@hidden: 

> On Fri, 12 Apr 2002, Paul D. Smith <address@hidden> wrote:
> 
>> %% Trevor Jenkins <address@hidden> writes:
>>
>>   tj> I'm trying to understand the use of # in makefiles.
>>
>> Any occurance of a literal "#" in the makefile is considered a
>> comment except in the following situations:
> 
>> Using backslash to escape the comment character is the official
>> method. This is even required by the POSIX standard for make.  If the
>> docs don't make this clear, there's a bug there.
> 
> Here's all I could find the docs to say:
> 
>|* `#' in a line of a makefile starts a "comment".  It and the rest of
>|     the line are ignored, except that a trailing backslash not
>|     escaped by another backslash will continue the comment across
>|     multiple lines.  Comments may appear on any of the lines in the
>|     makefile, except within a `define' directive, and perhaps within
>|     commands (where the shell decides what is a comment).  A line
>|     containing just a comment (with perhaps spaces before it) is
>|     effectively blank, and is ignored.
> 
> No mention of a backslash there as an escape for the #.  And just to
> be certain, in case my version of make is older, I checked the text at
> http://www.fsf.org/manual/make/html_node/make_14.html#SEC13 it too
> does not mention the escape route either.

I've read the make manual many times and so I think that this omission
IS a documentation 'bug'. 

I, also, did not know until reading this thread, that a backslash would
be used to escape the meaning of a '#' to make. I would naturally have
tried that, I suppose, at some point along the line, if i had been faced
with the requirements that Trevor was. But it wouldn't have been easy to
figure out since it isn't orthogonal with the rest of make: '\$' doesn't
escape a dollar sign, for example (only '$$' -- doubled dollars -- allow
a symbol starting with '$' to be unmolested by make). 

  Best,
   Soren A









reply via email to

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