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

Nick Alcock nick.alcock at oracle.com
Wed Nov 29 16:08:27 UTC 2023


'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>
---
 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