Next: Long Lines in Makefiles, Previous: Backslash-Newline-Empty, Up: Portable Make [Contents][Index]
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