Avoid (re)building the kconfig dependencies when we don't need them (clean, build, list-steps...).
/trunk/kconfig/kconfig.mk | 24 20 4 0 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
1.1 --- a/kconfig/kconfig.mk Sat Oct 18 18:37:28 2008 +0000
1.2 +++ b/kconfig/kconfig.mk Sun Oct 19 09:34:32 2008 +0000
1.3 @@ -14,17 +14,20 @@
1.4 #-----------------------------------------------------------
1.5 # The configurators rules
1.6
1.7 -PHONY += oldconfig menuconfig defoldconfig
1.8 +configurators = menuconfig oldconfig defoldconfig
1.9 +PHONY += $(configurators)
1.10
1.11 -menuconfig: $(obj)/mconf config_files
1.12 +$(configurators): config_files
1.13 +
1.14 +menuconfig: $(obj)/mconf
1.15 @$(ECHO) " MCONF $(KCONFIG_TOP)"
1.16 $(SILENT)$< $(KCONFIG_TOP)
1.17
1.18 -oldconfig: $(obj)/conf .config config_files
1.19 +oldconfig: $(obj)/conf .config
1.20 @$(ECHO) " CONF $(KCONFIG_TOP)"
1.21 $(SILENT)$< -s $(KCONFIG_TOP)
1.22
1.23 -defoldconfig: $(obj)/conf .config config_files
1.24 +defoldconfig: $(obj)/conf .config
1.25 @$(ECHO) " CONF $(KCONFIG_TOP)"
1.26 $(SILENT)yes "" |$< -s $(KCONFIG_TOP)
1.27
1.28 @@ -68,8 +71,21 @@
1.29
1.30 # Cheesy auto-dependencies
1.31 DEPS = $(patsubst %.c,%.dep,$(sort $(conf_SRC) $(mconf_SRC)))
1.32 +
1.33 +# Only parse the following if a configurator was called, to avoid building
1.34 +# dependencies when not needed (eg. list-steps, list-samples...)
1.35 +# We must be carefull what we enclose, because we need some of the variable
1.36 +# definitions for clean (and distclean) at least.
1.37 +# Just protecting the "-include $(DEPS)" line should be sufficient.
1.38 +
1.39 +ifneq ($(strip $(MAKECMDGOALS)),)
1.40 +ifneq ($(strip $(filter $(configurators),$(MAKECMDGOALS))),)
1.41 +
1.42 -include $(DEPS)
1.43
1.44 +endif # MAKECMDGOALS contains a configurator rule
1.45 +endif # MAKECMDGOALS != ""
1.46 +
1.47 # This is not very nice, as they will get rebuild even if (dist)cleaning... :-(
1.48 # Should look into the Linux kernel Kbuild to see how they do that...
1.49 # To really make me look into this, keep the annoying "DEP xxx" messages.