From eea2541514a26d3ebb09ef5401b97b4a441ca8d4 Mon Sep 17 00:00:00 2001 From: Kai Germaschewski Date: Wed, 23 Oct 2002 10:26:57 -0500 Subject: kbuild: Switch "make modules_install" to fast mode ;) Use the same way we came up with for "make clean" for "make modules_install", gaining a nice speed-up. Also, some cosmetics for scripts/Makefile.clean --- scripts/Makefile.clean | 29 ++++++++++++++++++++++--- scripts/Makefile.modinst | 56 +++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 08ada532a4a1..14a71984c6e4 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -1,3 +1,6 @@ +# ========================================================================== +# Cleaning up +# ========================================================================== src := $(obj) @@ -8,6 +11,9 @@ __clean: include $(obj)/Makefile +# Figure out what we need to build from the various variables +# ========================================================================== + __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) subdir-y += $(__subdir-y) __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) @@ -17,26 +23,43 @@ subdir-n += $(__subdir-n) __subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) subdir- += $(__subdir-) +# Subdirectories we need to descend into + subdir-ym := $(sort $(subdir-y) $(subdir-m)) subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) +# Add subdir path + EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) clean-files := $(addprefix $(obj)/,$(clean-files)) host-progs := $(addprefix $(obj)/,$(host-progs)) subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) +# ========================================================================== + __clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files)) +quiet_cmd_clean = CLEAN $(__cleanfiles) + cmd_clean = rm -f $(__clean-files); $(clean-rule) + __clean: $(subdir-ymn) ifneq ($(strip $(__clean-files) $(clean-rule)),) - rm -f $(__clean-files) - $(clean-rule) + $(call cmd,clean) else @: endif -.PHONY: $(subdir-ymn) +# =========================================================================== +# Generic stuff +# =========================================================================== + +# Descending +# --------------------------------------------------------------------------- +.PHONY: $(subdir-ymn) $(subdir-ymn): $(Q)$(MAKE) -rR -f scripts/Makefile.clean obj=$@ +# If quiet is set, only print short version of command + +cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 6e1fe0e5bcbd..6dcc5b132fb1 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -2,11 +2,47 @@ # Installing modules # ========================================================================== -quiet_cmd_modules_install = INSTALL $(obj-m) -cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \ - cp $(obj-m) $(MODLIB)/kernel/$(obj) +src := $(obj) + +no-rules.make := 1 .PHONY: modules_install +modules_install: + +include .config + +#$(warning $(CONFIG_X86)) + +include $(obj)/Makefile + +# Figure out what we need to build from the various variables +# ========================================================================== + +# When an object is listed to be built compiled-in and modular, +# only build the compiled-in version + +obj-m := $(filter-out $(obj-y),$(obj-m)) + +__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) +subdir-y += $(__subdir-y) +__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) +subdir-m += $(__subdir-m) +obj-m := $(filter-out %/, $(obj-m)) + +# Subdirectories we need to descend into + +subdir-ym := $(sort $(subdir-y) $(subdir-m)) + +# Add subdir path + +obj-m := $(addprefix $(obj)/,$(obj-m)) +subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) + +# ========================================================================== + +quiet_cmd_modules_install = INSTALL $(obj-m) + cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \ + cp $(obj-m) $(MODLIB)/kernel/$(obj) modules_install: $(subdir-ym) ifneq ($(obj-m),) @@ -15,3 +51,17 @@ else @: endif +# =========================================================================== +# Generic stuff +# =========================================================================== + +# Descending +# --------------------------------------------------------------------------- + +.PHONY: $(subdir-ym) +$(subdir-ym): + $(Q)$(MAKE) -rR -f scripts/Makefile.modinst obj=$@ + +# If quiet is set, only print short version of command + +cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) -- cgit v1.2.3