manpagez: man pages & more
info autoconf
Home | html | info | man

File: autoconf.info,  Node: Backslash-Newline Comments,  Next: Long Lines in Makefiles,  Prev: Backslash-Newline-Empty,  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 \
           baz

     all:
             @echo ok
     $ make   # GNU make
     ok

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

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.