From: Sam Ravnborg When building a kernel right after 'make mrproper' resulted in a very short run, and no sign that .config was missing. This has been fixed by adding a new rule for .config in the top-level Makefile, and a new target 'silentoldconfig' in scripts/kconfig/Makefile. Also cleaned up a bit in scripts/kconfig/Makefile Makefile | 45 +++++++++++++++++++++++++++++++-------------- scripts/kconfig/Makefile | 45 ++++++++++++++++++++++++--------------------- 2 files changed, 55 insertions(+), 35 deletions(-) diff -puN Makefile~handle-unreadable-dot-config Makefile --- 25/Makefile~handle-unreadable-dot-config 2003-08-24 14:14:45.000000000 -0700 +++ 25-akpm/Makefile 2003-08-24 14:14:45.000000000 -0700 @@ -268,8 +268,19 @@ scripts: # Detect when mixed targets is specified, and make a second invocation # of make so .config is not included in this case either (for *config). +no-dot-config-targets := clean mrproper distclean \ + cscope TAGS tags help %docs check% + config-targets := 0 mixed-targets := 0 +dot-config := 1 + +ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),) + ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),) + dot-config := 0 + endif +endif + ifneq ($(filter config %config,$(MAKECMDGOALS)),) config-targets := 1 ifneq ($(filter-out config %config,$(MAKECMDGOALS)),) @@ -309,7 +320,26 @@ libs-y := lib/ core-y := usr/ SUBDIRS := --include .config +ifeq ($(dot-config),1) +# In this section, we need .config + +# Read in dependencies to all Kconfig* files, make sure to run +# oldconfig is changes are detected. +-include .config.cmd + +include .config + +# If .config does not exist run silentconfig - this will tell the +# user whats wrong +.config: scripts/fixdep + $(Q)$(MAKE) $(build)=scripts/kconfig silentoldconfig + +# if .config is newer than include/linux/autoconf.h, someone tinkered +# with it and forgot to run make oldconfig +include/linux/autoconf.h: .config scripts/fixdep + $(Q)$(MAKE) $(build)=scripts/kconfig silentoldconfig + +endif include arch/$(ARCH)/Makefile @@ -338,15 +368,7 @@ libs-y := $(libs-y1) $(libs-y2) # Here goes the main Makefile # --------------------------------------------------------------------------- -# -# If the user gave a *config target, it'll be handled in another -# section below, since in this case we cannot include .config -# Same goes for other targets like clean/mrproper etc, which -# don't need .config, either -# In this section, we need .config - --include .config.cmd ifndef CONFIG_FRAME_POINTER CFLAGS += -fomit-frame-pointer @@ -521,13 +543,6 @@ include/config/MARKER: scripts/split-inc @scripts/split-include include/linux/autoconf.h include/config @touch $@ -# if .config is newer than include/linux/autoconf.h, someone tinkered -# with it and forgot to run make oldconfig - -include/linux/autoconf.h: .config scripts/fixdep - $(Q)$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf - ./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig - # Generate some files # --------------------------------------------------------------------------- diff -puN scripts/kconfig/Makefile~handle-unreadable-dot-config scripts/kconfig/Makefile --- 25/scripts/kconfig/Makefile~handle-unreadable-dot-config 2003-08-24 14:14:45.000000000 -0700 +++ 25-akpm/scripts/kconfig/Makefile 2003-08-24 14:14:45.000000000 -0700 @@ -2,40 +2,43 @@ # Kernel configuration targets # These targets are used from top-level makefile -.PHONY: oldconfig xconfig gconfig menuconfig config +.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig -xconfig: scripts/kconfig/qconf - ./scripts/kconfig/qconf arch/$(ARCH)/Kconfig +xconfig: $(obj)/qconf + $< arch/$(ARCH)/Kconfig -gconfig: scripts/kconfig/gconf - ./scripts/kconfig/gconf arch/$(ARCH)/Kconfig +gconfig: $(obj)/gconf + ./$< arch/$(ARCH)/Kconfig -menuconfig: scripts/kconfig/mconf +menuconfig: $(obj)/mconf $(Q)$(MAKE) $(build)=scripts/lxdialog - ./scripts/kconfig/mconf arch/$(ARCH)/Kconfig + $< arch/$(ARCH)/Kconfig -config: scripts/kconfig/conf - ./scripts/kconfig/conf arch/$(ARCH)/Kconfig +config: $(obj)/conf + $< arch/$(ARCH)/Kconfig -oldconfig: scripts/kconfig/conf - ./scripts/kconfig/conf -o arch/$(ARCH)/Kconfig +oldconfig: $(obj)/conf + $< -o arch/$(ARCH)/Kconfig + +silentoldconfig: $(obj)/conf + $< -s arch/$(ARCH)/Kconfig .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig -randconfig: scripts/kconfig/conf - ./scripts/kconfig/conf -r arch/$(ARCH)/Kconfig +randconfig: $(obj)/conf + $< -r arch/$(ARCH)/Kconfig -allyesconfig: scripts/kconfig/conf - ./scripts/kconfig/conf -y arch/$(ARCH)/Kconfig +allyesconfig: $(obj)/conf + $< -y arch/$(ARCH)/Kconfig -allnoconfig: scripts/kconfig/conf - ./scripts/kconfig/conf -n arch/$(ARCH)/Kconfig +allnoconfig: $(obj)/conf + $< -n arch/$(ARCH)/Kconfig -allmodconfig: scripts/kconfig/conf - ./scripts/kconfig/conf -m arch/$(ARCH)/Kconfig +allmodconfig: $(obj)/conf + $< -m arch/$(ARCH)/Kconfig -defconfig: scripts/kconfig/conf - ./scripts/kconfig/conf -d arch/$(ARCH)/Kconfig +defconfig: $(obj)/conf + $< -d arch/$(ARCH)/Kconfig # Help text used by make help help: _