[DTrace-devel] [PATCH 3/5] build: avoid building config.mk unnecessarily

Kris Van Hees kris.van.hees at oracle.com
Thu Dec 21 19:28:09 UTC 2023


On Wed, Nov 29, 2023 at 04:08:27PM +0000, Nick Alcock wrote:
> 'make help' and similar targets in a clean tree can take quite a
> long time, and can even fail(!), because the unconditional inclusion
> of config.mk forces all the Makeconfig machinery to run even if we
> are doing nothing that might ever need any of it.
> 
> Include it only when we're not asking for things like help,
> make dist, make clean and things like that.  (A surprising amount
> does depend on config.mk and more will depend on it once we start
> to optionally bake installation paths into it, but this subset
> seems likely never to need it.)
> 
> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>

Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>

... but I note that make help, make help-overrides, etc... all take quite a
    bit of time even with this patch.  There is a noticable delay (~1s)
    between issueing the command and getting output, which is surprising since
    it shouldn't have to do much.

    This is also quite visible in the ./confgure --help output where you get
    the first screen full right away, then have a ~1s pause, and then the rest
    comes (from make help-overrides).

    So, more work on this is needed I think to streamline things.

> ---
>  GNUmakefile | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/GNUmakefile b/GNUmakefile
> index c987a1ee19b7..619b709bf78e 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -116,7 +116,12 @@ $(shell mkdir -p $(objdir))
>  include Makeoptions
>  include Makefunctions
>  include Makeconfig
> +
> +# Building config.mk is quite expensive: avoid doing it when only
> +# documentation targets and such things are invoked.
> +ifeq ($(strip $(filter %clean help% dist tags TAGS gtags,$(MAKECMDGOALS))),)
>  -include $(objdir)/config.mk
> +endif
>  include Build $(sort $(wildcard */Build))
>  -include $(objdir)/*.deps
>  include Makerules
> -- 
> 2.42.0.271.g85384428f1
> 
> 



More information about the DTrace-devel mailing list