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

Nick Alcock nick.alcock at oracle.com
Fri Jan 26 13:58:43 UTC 2024


'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>
---
 GNUmakefile | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/GNUmakefile b/GNUmakefile
index 2ffd4c497886..723c81033992 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -115,7 +115,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.43.0.272.gce700b77fd




More information about the DTrace-devel mailing list