Re: comments in make variable definition

2011-01-04 Thread Ralf Wildenhues
* 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



Re: comments in make variable definition

2010-12-25 Thread Pippijn van Steenhoven
On Wed, Dec 22, 2010 at 06:17:47PM +0100, Stefano Lattarini wrote:
 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
 
 Try also to search:
   ^[^\t#].*=.*\s# file:^Makefile\.am$
 with google code search (not many entries, luckily, but still).
 
 Regards,
Stefano

Actually it is not always ok. FreeBSD's make chokes on it in some
instances:
  VAR = foo # this comment is ok
  VAR = foo \
# this is also ok
  VAR = foo \
# this is ok \
# - Unassociated shell command

Also, it will break $(am__append*) variables, but that is not relevant in
this case.

-- 
Pippijn van Steenhoven


signature.asc
Description: Digital signature


comments in make variable definition

2010-12-22 Thread Stefano Lattarini
[dropping debbugs, adding automake]

[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

Try also to search:
  ^[^\t#].*=.*\s# file:^Makefile\.am$
with google code search (not many entries, luckily, but still).

Regards,
   Stefano