Subject: Re: [PATCH v3 3/9] Makefile: disable GNU make built-in wildcard rules

From: Junio C Hamano <[email-masked]>
Date: Fri, 25 Feb 2022 15:17:10 -0800

Ævar Arnfjörð Bjarmason  <[email-masked]> writes:

> Override built-in rules of GNU make that use a wildcard target. This
> can speeds things up significantly as we don't need to stat() so many
> files. GNU make does that by default to see if it can retrieve their
> contents from RCS or SCCS. See [1] for an old mailing list discussion
> about how to disable these.

;-)

> The speed-up may wary. I've seen 1-10% depending on the speed of the

vary, you mean?

> local disk, caches, -jN etc. Running:
>
>     strace -f -c -S calls make -j1 NO_TCLTK=Y
>
> Shows that we reduce the number of syscalls we make, mostly in "stat"
> calls.

Naturally understandable.

I do remember getting surprised after seeing output from "make -d"
and how many paths were considered for possible places that a source
file can come from.

> +### Remove GNU make implicit rules
> +
> +## This speeds things up since we don't need to look for and stat() a
> +## "foo.c,v" every time a rule referring to "foo.c" is in play. See
> +## "make -p -f/dev/null | grep ^%::'".
> +%:: %,v
> +%:: RCS/%,v
> +%:: RCS/%
> +%:: s.%
> +%:: SCCS/s.%
> +
>  ### Flags affecting all rules
>  
>  # A GNU make extension since gmake 3.72 (released in late 1994) to