autoconf: Comments in Make Macros

1 
1 12.13 Comments in Make Macros
1 =============================
1 
1 Avoid putting comments in macro values as far as possible.  Posix
1 specifies that the text starting from the `#' sign until the end of the
1 line is to be ignored, which has the unfortunate effect of disallowing
1 them even within quotes.  Thus, the following might lead to a syntax
1 error at compile time:
1 
1      CPPFLAGS = "-DCOMMENT_CHAR='#'"
1 
1 as `CPPFLAGS' may be expanded to `"-DCOMMENT_CHAR=''.
1 
1    Most `make' implementations disregard this and treat single and
1 double quotes specially here.  Also, GNU `make' lets you put `#' into a
1 macro value by escaping it with a backslash, i.e., `\#'.  However,
1 neither of these usages are portable.  ⇒Comments in Make Rules,
1 for a portable alternative.
1 
1    Even without quoting involved, comments can have surprising effects,
1 because the whitespace before them is part of the variable value:
1 
1      foo = bar # trailing comment
1      print: ; @echo "$(foo)."
1 
1 prints `bar .', which is usually not intended, and can expose `make'
1 bugs as described below.
1