summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2021-12-05 15:16:26 -0500
committerPaul Smith <psmith@gnu.org>2021-12-19 16:34:19 -0500
commit55b993ae09ad009c18e7097a78d3b868c16e15df (patch)
tree74dac7a8371bf545a4ac0e1c3a4fc215cfed4618 /doc
parent1d20aa7247ece1a08bed7fa4ba5ab6b7c0f332b0 (diff)
downloadmake-git-55b993ae09ad009c18e7097a78d3b868c16e15df.tar.gz
* doc/make.text (Wildcards): Document that glob results are sorted.
Diffstat (limited to 'doc')
-rw-r--r--doc/make.texi12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/make.texi b/doc/make.texi
index 3dea24f1..a565bf19 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -2142,6 +2142,13 @@ The wildcard characters in @code{make} are @samp{*}, @samp{?} and
specifies a list of all the files (in the working directory) whose names
end in @samp{.c}.@refill
+If an expression matches multiple files than the results will be
+sorted.@footnote{Some older versions of GNU @code{make} did not sort the
+results of wildcard expansion.} However multiple expressions will not be
+globally sorted. For example, @file{*.c *.h} will list all the files whose
+names end in @samp{.c}, sorted, followed by all the files whose names end in
+@samp{.h}, sorted.
+
@cindex @code{~} (tilde)
@cindex tilde (@code{~})
@cindex home directory
@@ -2309,6 +2316,11 @@ function. Note that this is different from how unmatched wildcards
behave in rules, where they are used verbatim rather than ignored
(@pxref{Wildcard Pitfall}).
+As with wildcard expansion in rules, the results of the @code{wildcard}
+function are sorted. But again, each individual expression is sorted
+separately, so @samp{$(wildcard *.c *.h)} will expand to all files matching
+@samp{.c}, sorted, followed by all files matching @samp{.h}, sorted.
+
One use of the @code{wildcard} function is to get a list of all the C source
files in a directory, like this: