[SV 65759] Document special handling of "-" command line option
* doc/make.1: Add information on "-" option handling.
* doc/make.texi: Ditto.
diff --git a/doc/make.1 b/doc/make.1
index 059bf75..5aff26d 100644
--- a/doc/make.1
+++ b/doc/make.1
@@ -412,6 +412,14 @@
.B \-\-warn\-undefined\-variables
A deprecated alternative for
.BR \-\-warn=undefined-var .
+.TP 0.5i
+.B \-
+This option alone (not as an argument to the
+.B \-f
+option) is ignored, unless a target named
+.B \-
+is defined in the makefile, in which case that target is added to the makefile
+goals.
.SH "EXIT STATUS"
GNU Make exits with a status of zero if all makefiles were successfully parsed
and no targets that were built failed. A status of one will be returned
diff --git a/doc/make.texi b/doc/make.texi
index ed0f1a4..62ac180 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -5218,14 +5218,11 @@
in the makefile. You probably do not care about this.)
@vindex MFLAGS
-A similar variable @code{MFLAGS} exists also, for historical
-compatibility. It has the same value as @code{MAKEFLAGS} except that it
-does not contain the command line variable definitions, and it always
-begins with a hyphen unless it is empty (@code{MAKEFLAGS} begins with a
-hyphen only when it begins with an option that has no single-letter
-version, such as @samp{--no-print-directory}). @code{MFLAGS} was
-traditionally used explicitly in the recursive @code{make} command, like
-this:
+A similar variable @code{MFLAGS} exists also, for historical compatibility.
+It has the same value as @code{MAKEFLAGS} except that it does not contain the
+command line variable definitions, and it always begins with a hyphen unless
+it is empty. @code{MFLAGS} was traditionally used explicitly in the recursive
+@code{make} command, like this:
@example
subsystem:
@@ -7502,7 +7499,7 @@
Recall that @code{MAKEFLAGS} will put all single-letter options (such as
@samp{-t}) into the first word, and that word will be empty if no
single-letter options were given. To work with this, it's helpful to add a
-value at the start to ensure there's a word: for example
+value at the start to ensure it's considered a word: for example
@samp{-$(MAKEFLAGS)}.
The @code{findstring} function determines whether one string appears as a
@@ -9582,6 +9579,20 @@
Here is a table of all the options @code{make} understands:
@table @samp
+@item --
+@cindex @code{--}
+This signals the end of options. Any subsequent command line arguments are
+considered to be @code{make} targets or variable assignments, even if they
+look like options.
+
+@item -
+@cindex @code{-}
+GNU Make treats a @code{-} option in a special way: if there is a target
+@code{-} defined in the makefile then that target will be built. If there is
+no target @code{-} then this option is ignored. This historical behavior
+supports the (deprecated) sub-@code{make} invocation style @samp{$(MAKE)
+-$(MAKEFLAGS)} (do not use this).
+
@item -b
@cindex @code{-b}
@itemx -m