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 authored and kvanhees committed Feb 7, 2024
1 parent 5528219 commit d73277c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Build files in subdirectories are included by this file.
#
# Oracle Linux DTrace.
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.

Expand Down Expand Up @@ -122,7 +122,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 d73277c

Please sign in to comment.