The $subject isn't strictly true, as the it's implemented in terms of MatchFirst() on Amiga, but that's obscure enough to not be noted in the manual, and in any case the tests added in 0d366b66 (* Added the test suite to the main distribution., 1999-09-14) show that the output is sorted on all platforms GNU make has been tested on.
The motivation for this patch is that I've seen code like this in the wild: FILES = $(sort $(wildcard t*.sh)) I thought that it would be documented that that sort of thing was redundant, but I didn't find any mention of it in the manual. After some source spelunking I came up with this addition, which would have helped me when I consulted the manual. --- Aside: I found it difficult to figure out how to submit patches to this project. The Savannah page suggests the bug tracker, but as af writing (and I'm logged in, as "avar") that link appears greyed out in the web interface, and has a <span class="disabled">. doc/make.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/make.texi b/doc/make.texi index 4470386d..5cab7a9c 100644 --- a/doc/make.texi +++ b/doc/make.texi @@ -7664,6 +7664,12 @@ The argument @var{pattern} is a file name pattern, typically containing wildcard characters (as in shell file name patterns). The result of @code{wildcard} is a space-separated list of the names of existing files that match the pattern. + +The @code{wildcard} function is implemented in terms of the system's +@code{glob(3)} function (without a @code{GLOB_NOSORT} being +provided). So there's no reason to @code{$(sort)} its output if the +goal is to get output sorted in @code{glob(3)} order. + @xref{Wildcards, ,Using Wildcard Characters in File Names}. @item $(realpath @var{names}@dots{}) -- 2.34.GIT-dev