autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Limitations of Make: Escaped newline in comments


From: Alexandre Duret-Lutz
Subject: Limitations of Make: Escaped newline in comments
Date: 25 Jul 2002 00:14:43 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Another one.

2002-07-25  Alexandre Duret-Lutz  <address@hidden>

        * doc/autoconf.texi (Limitations of Make): Escaped newlines in
        comments do not always work.

Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.651
diff -u -r1.651 autoconf.texi
--- doc/autoconf.texi   24 Jul 2002 00:38:49 -0000      1.651
+++ doc/autoconf.texi   24 Jul 2002 22:20:32 -0000
@@ -10276,6 +10276,44 @@
 shows @code{FOO} equal to @code{one BAR = two}.  Other Makes sensibly
 let a backslash continue only to the immediately following line.
 
address@hidden Escaped newline in comments
+
+According to @sc{posix}, Makefile comments start with @code{#} and
+continue until an unescaped newline is reached.
+
address@hidden
+% @kbd{cat Makefile}
+# A = foo \
+      bar \
+      baz
+
+all:
+        @@echo ok
+% @kbd{make}   # GNU make
+ok
address@hidden example
+
address@hidden
+However in Real World this is not always the case.  Some implementations
+discards anything from @code{#} up to the end of line, ignoring any
+trailing backslash.
+
address@hidden
+% @kbd{pmake}  # BSD make
+"Makefile", line 3: Need an operator
+Fatal errors encountered -- cannot continue
address@hidden example
+
address@hidden
+Therefore, if you want to comment a multi-line definition, prefix each
+line with @code{#}, not only the first.
+
address@hidden
+# A = foo \
+#     bar \
+#     baz
address@hidden example
+
 @item @code{make macro=value} and address@hidden
 
 A command-line variable definition such as @code{foo=bar} overrides any
-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]