Commit eea25415 authored by Kai Germaschewski's avatar Kai Germaschewski

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
parent 35bce88f
...@@ -544,8 +544,7 @@ _modinst_post: ...@@ -544,8 +544,7 @@ _modinst_post:
.PHONY: $(patsubst %, _modinst_%, $(SUBDIRS)) .PHONY: $(patsubst %, _modinst_%, $(SUBDIRS))
$(patsubst %, _modinst_%, $(SUBDIRS)) : $(patsubst %, _modinst_%, $(SUBDIRS)) :
+@$(call descend,$(patsubst _modinst_%,%,$@),modules_install) $(Q)$(MAKE) MAKEFILES= -rR -f scripts/Makefile.modinst obj=$(patsubst _modinst_%,%,$@)
else # CONFIG_MODULES else # CONFIG_MODULES
# Modules not configured # Modules not configured
......
...@@ -24,8 +24,7 @@ endif ...@@ -24,8 +24,7 @@ endif
clean-files := aic7xxx_seq.h aic7xxx_reg.h clean-files := aic7xxx_seq.h aic7xxx_reg.h
# Command to be executed upon make clean # Command to be executed upon make clean
# Note: Assignment without ':' to force late evaluation of $(src) clean-rule := $(MAKE) -C $(src)/aicasm clean
clean-rule = @$(MAKE) -C $(src)/aicasm clean
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -39,7 +38,7 @@ ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y) ...@@ -39,7 +38,7 @@ ifeq ($(CONFIG_AIC7XXX_BUILD_FIRMWARE),y)
$(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg \ $(obj)/aic7xxx_seq.h: $(src)/aic7xxx.seq $(src)/aic7xxx.reg \
$(obj)/aicasm/aicasm $(obj)/aicasm/aicasm
$(obj)/aicasm/aicasm -I. -r $(obj)/aic7xxx_reg.h \ $(obj)/aicasm/aicasm -I$(obj) -r $(obj)/aic7xxx_reg.h \
-o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq -o $(obj)/aic7xxx_seq.h $(src)/aic7xxx.seq
$(obj)/aic7xxx_reg.h: $(obj)/aix7xxx_seq.h $(obj)/aic7xxx_reg.h: $(obj)/aix7xxx_seq.h
......
# ==========================================================================
# Cleaning up
# ==========================================================================
src := $(obj) src := $(obj)
...@@ -8,6 +11,9 @@ __clean: ...@@ -8,6 +11,9 @@ __clean:
include $(obj)/Makefile include $(obj)/Makefile
# Figure out what we need to build from the various variables
# ==========================================================================
__subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y))) __subdir-y := $(patsubst %/,%,$(filter %/, $(obj-y)))
subdir-y += $(__subdir-y) subdir-y += $(__subdir-y)
__subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m))) __subdir-m := $(patsubst %/,%,$(filter %/, $(obj-m)))
...@@ -17,26 +23,43 @@ subdir-n += $(__subdir-n) ...@@ -17,26 +23,43 @@ subdir-n += $(__subdir-n)
__subdir- := $(patsubst %/,%,$(filter %/, $(obj-))) __subdir- := $(patsubst %/,%,$(filter %/, $(obj-)))
subdir- += $(__subdir-) subdir- += $(__subdir-)
# Subdirectories we need to descend into
subdir-ym := $(sort $(subdir-y) $(subdir-m)) subdir-ym := $(sort $(subdir-y) $(subdir-m))
subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-)) subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# Add subdir path
EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS)) EXTRA_TARGETS := $(addprefix $(obj)/,$(EXTRA_TARGETS))
clean-files := $(addprefix $(obj)/,$(clean-files)) clean-files := $(addprefix $(obj)/,$(clean-files))
host-progs := $(addprefix $(obj)/,$(host-progs)) host-progs := $(addprefix $(obj)/,$(host-progs))
subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn)) subdir-ymn := $(addprefix $(obj)/,$(subdir-ymn))
# ==========================================================================
__clean-files := $(wildcard $(EXTRA_TARGETS) $(host-progs) $(clean-files)) __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) __clean: $(subdir-ymn)
ifneq ($(strip $(__clean-files) $(clean-rule)),) ifneq ($(strip $(__clean-files) $(clean-rule)),)
rm -f $(__clean-files) $(call cmd,clean)
$(clean-rule)
else else
@: @:
endif endif
.PHONY: $(subdir-ymn) # ===========================================================================
# Generic stuff
# ===========================================================================
# Descending
# ---------------------------------------------------------------------------
.PHONY: $(subdir-ymn)
$(subdir-ymn): $(subdir-ymn):
$(Q)$(MAKE) -rR -f scripts/Makefile.clean obj=$@ $(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))
...@@ -2,11 +2,47 @@ ...@@ -2,11 +2,47 @@
# Installing modules # Installing modules
# ========================================================================== # ==========================================================================
quiet_cmd_modules_install = INSTALL $(obj-m) src := $(obj)
cmd_modules_install = mkdir -p $(MODLIB)/kernel/$(obj); \
cp $(obj-m) $(MODLIB)/kernel/$(obj) no-rules.make := 1
.PHONY: modules_install .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) modules_install: $(subdir-ym)
ifneq ($(obj-m),) ifneq ($(obj-m),)
...@@ -15,3 +51,17 @@ else ...@@ -15,3 +51,17 @@ else
@: @:
endif 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))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment