Next: , Previous: Backslash-Newline-Newline, Up: Portable Make

12.5 Backslash-Newline in Make Comments

According to Posix, Make comments start with # and continue until an unescaped newline is reached.

     $ cat Makefile
     # A = foo \
           bar \
             @echo ok
     $ make   # GNU make

However this is not always the case. Some implementations discard everything from # through the end of the line, ignoring any trailing backslash.

     $ pmake  # BSD make
     "Makefile", line 3: Need an operator
     Fatal errors encountered -- cannot continue

Therefore, if you want to comment out a multi-line definition, prefix each line with #, not only the first.

     # A = foo \
     #     bar \
     #     baz