]> git.neil.brown.name Git - history.git/commitdiff
kbuild: Speed up vmlinux build
authorKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Mon, 20 May 2002 09:22:57 +0000 (04:22 -0500)
committerKai Germaschewski <kai@tp1.ruhr-uni-bochum.de>
Mon, 20 May 2002 09:22:57 +0000 (04:22 -0500)
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)

Rules.make

index 756f5bbcd8e5c9e256e3934d09d4a5a9196415a7..b4d5f2f84457994cc26a2d5a47edd24a2b44da0b 100644 (file)
@@ -41,8 +41,7 @@ obj-m := $(filter-out $(obj-y),$(obj-m))
 #
 # Get things started.
 #
-first_rule: sub_dirs
-       $(MAKE) all_targets
+first_rule: all_targets
 
 both-m          := $(filter $(mod-subdirs), $(subdir-y))
 SUB_DIRS       := $(subdir-y)
@@ -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