automake
[Top][All Lists]
Advanced

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

Re: comments in make variable definition


From: Ralf Wildenhues
Subject: Re: comments in make variable definition
Date: Tue, 4 Jan 2011 21:02:37 +0100
User-agent: Mutt/1.5.20 (2010-08-04)

* Stefano Lattarini wrote on Wed, Dec 22, 2010 at 06:17:47PM CET:
> [stemming from discussion about automake bug#7657:
>  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7657>]
> 
> On Tuesday 21 December 2010, Ralf Wildenhues wrote:
> > * Stefano Lattarini wrote on Tue, Dec 21, 2010 at 01:55:39PM CET:
> > > On Sunday 19 December 2010, Ralf Wildenhues wrote:
> > > > * Stefano Lattarini wrote on Fri, Dec 17, 2010 at 12:19:40PM CET:
> > > > >   xmandir = $(mandir) # we want info files installed in $(mandir) 
> > > > > because ...
> > > > >   xman_TEXINFOS = foo.texi
> > > >
> > > > (And the inline comment is of course not ok ;-)
> > >
> > > (Maybe it's time to deprecate them too in the manual ...)
> > 
> > I don't see how they were ever not problematic.  Well, at least given
> > the autoconf.texi general warnings about comments in makefiles.
> > 
> Ah, but AFAIK, make comments are problematic only in makefile *rules*,
> not in variable definitions:
>   VAR = foo bar # a probably portable comment
>   tgt:; touch $@ # a bad unportable commen

Not quite.  The above comment in the variable definition is not
unportable, but it is unobvious: For a Posix make, the above defines VAR
to be 'foo bar '.  Note the trailing space!

If automake parses it differently, then that is a semantic difference to
how Posix make reads its input.  (We may have a couple such differences
already, but in general, they are not desirable.)

What you are hinting at is # signs within quoted parts of a variable
definition, like '#' or "#" or more complex things.  Posix notes:

  Because of widespread historical practice, interpreting a '#' number sign
  inside a variable as the start of a comment has the unfortunate side effect
  of making it impossible to place a number sign in a variable, thus
  forbidding something like:

   CFLAGS = "-D COMMENT_CHAR='#'"

but most modern makes treat quoted content differently.  (No, I have not
done research as to how exactly quoted content is defined by the various
make implementations.  I'm sure there are variations here as well.)

Cheers,
Ralf



reply via email to

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