Skip to content

Commit

Permalink
build: avoid building config.mk unnecessarily
Browse files Browse the repository at this point in the history
'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@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock committed Jan 15, 2024
1 parent 77bfc17 commit e04bd40
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e04bd40

Please sign in to comment.