Commit a6209819 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Speed up vmlinux build

The recursive build used to do the following: On entering a directory,
we would first call make in the subdirectories listed in $(subdir-y),
and then call make in the current directory again, with the target
'all_targets'.

The second invocation was used to make sure that the subdir makes completed
before trying to build the O_TARGET/L_TARGET in the current dir, since
this would link in objects in these subdirectories.

However, using correct dependencies achieves the same, i.e. just
make the objects in $(obj-y) which are not in the local subdirectory
depend on 'sub_dirs', which is the rule to descend into subdirs.

This patch actually halves the time "make vmlinux" takes when there's
nothing to do (which makes sense, as we save half of the make invocations)
parent 159b176d
...@@ -41,8 +41,7 @@ obj-m := $(filter-out $(obj-y),$(obj-m)) ...@@ -41,8 +41,7 @@ obj-m := $(filter-out $(obj-y),$(obj-m))
# #
# Get things started. # Get things started.
# #
first_rule: sub_dirs first_rule: all_targets
$(MAKE) all_targets
both-m := $(filter $(mod-subdirs), $(subdir-y)) both-m := $(filter $(mod-subdirs), $(subdir-y))
SUB_DIRS := $(subdir-y) SUB_DIRS := $(subdir-y)
...@@ -102,7 +101,13 @@ endif ...@@ -102,7 +101,13 @@ endif
# #
# #
# #
all_targets: $(O_TARGET) $(L_TARGET) all_targets: $(O_TARGET) $(L_TARGET) sub_dirs
# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live
# in the local directory
subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
# Do build these objects, we need to descend into the directories
$(subdir-obj-y): sub_dirs
# #
# Rule to compile a set of .o files into one .o file # Rule to compile a set of .o files into one .o file
......
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