@@ -1016,6 +1016,8 @@ vmlinux-alldirs := $(sort $(vmlinux-dirs) Documentation \
10161016 $(patsubst % /,% ,$(filter % /, $(init- ) $(core- ) \
10171017 $(drivers- ) $(net- ) $(libs- ) $(virt- ) ) ) )
10181018
1019+ build-dirs := $(vmlinux-dirs )
1020+
10191021init-y := $(patsubst % /, % /built-in.a, $(init-y ) )
10201022core-y := $(patsubst % /, % /built-in.a, $(core-y ) )
10211023drivers-y := $(patsubst % /, % /built-in.a, $(drivers-y ) )
@@ -1038,7 +1040,7 @@ vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)
10381040# Recurse until adjust_autoksyms.sh is satisfied
10391041PHONY += autoksyms_recursive
10401042ifdef CONFIG_TRIM_UNUSED_KSYMS
1041- autoksyms_recursive : $( vmlinux-deps ) modules.order
1043+ autoksyms_recursive : descend modules.order
10421044 $(Q )$(CONFIG_SHELL ) $(srctree ) /scripts/adjust_autoksyms.sh \
10431045 " $( MAKE) -f $( srctree) /Makefile vmlinux"
10441046endif
@@ -1070,17 +1072,7 @@ targets := vmlinux
10701072
10711073# The actual objects are generated when descending,
10721074# make sure no implicit rule kicks in
1073- $(sort $(vmlinux-deps ) ) : $(vmlinux-dirs ) ;
1074-
1075- # Handle descending into subdirectories listed in $(vmlinux-dirs)
1076- # Preset locale variables to speed up the build process. Limit locale
1077- # tweaks to this spot to avoid wrong language settings when running
1078- # make menuconfig etc.
1079- # Error messages still appears in the original language
1080-
1081- PHONY += $(vmlinux-dirs )
1082- $(vmlinux-dirs ) : prepare
1083- $(Q )$(MAKE ) $(build ) =$@ need-builtin=1 need-modorder=1
1075+ $(sort $(vmlinux-deps ) ) : descend ;
10841076
10851077filechk_kernel.release = \
10861078 echo "$(KERNELVERSION )$$($(CONFIG_SHELL ) $(srctree ) /scripts/setlocalversion $(srctree ) ) "
@@ -1302,13 +1294,13 @@ modules: $(if $(KBUILD_BUILTIN),vmlinux) modules.order modules.builtin
13021294 $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modpost
13031295 $(Q )$(CONFIG_SHELL ) $(srctree ) /scripts/modules-check.sh
13041296
1305- modules.order : $( vmlinux-dirs )
1306- $(Q )$(AWK ) ' !x[$$0]++' $(addsuffix /$@ , $(vmlinux -dirs ) ) > $@
1297+ modules.order : descend
1298+ $(Q )$(AWK ) ' !x[$$0]++' $(addsuffix /$@ , $(build -dirs ) ) > $@
13071299
1308- modbuiltin-dirs := $(addprefix _modbuiltin_, $(vmlinux -dirs ) )
1300+ modbuiltin-dirs := $(addprefix _modbuiltin_, $(build -dirs ) )
13091301
13101302modules.builtin : $(modbuiltin-dirs )
1311- $(Q )$(AWK ) ' !x[$$0]++' $(addsuffix /$@ , $(vmlinux -dirs ) ) > $@
1303+ $(Q )$(AWK ) ' !x[$$0]++' $(addsuffix /$@ , $(build -dirs ) ) > $@
13121304
13131305PHONY += $(modbuiltin-dirs )
13141306# tristate.conf is not included from this Makefile. Add it as a prerequisite
@@ -1618,12 +1610,9 @@ $(objtree)/Module.symvers:
16181610 echo " is missing; modules will have no dependencies and modversions." ; \
16191611 echo )
16201612
1621- module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD ) )
1622- PHONY += $(module-dirs ) modules
1623- $(module-dirs ) : prepare
1624- $(Q )$(MAKE ) $(build ) =$(patsubst _module_% ,% ,$@ ) need-modorder=1
1625-
1626- modules : $(module-dirs ) $(objtree ) /Module.symvers
1613+ build-dirs := $(KBUILD_EXTMOD )
1614+ PHONY += modules
1615+ modules : descend $(objtree ) /Module.symvers
16271616 @$(kecho ) ' Building modules, stage 2.' ;
16281617 $(Q )$(MAKE ) -f $(srctree ) /scripts/Makefile.modpost
16291618
@@ -1665,6 +1654,16 @@ help:
16651654PHONY += prepare
16661655endif # KBUILD_EXTMOD
16671656
1657+ # Handle descending into subdirectories listed in $(build-dirs)
1658+ # Preset locale variables to speed up the build process. Limit locale
1659+ # tweaks to this spot to avoid wrong language settings when running
1660+ # make menuconfig etc.
1661+ # Error messages still appears in the original language
1662+ PHONY += descend $(build-dirs )
1663+ descend : $(build-dirs )
1664+ $(build-dirs ) : prepare
1665+ $(Q )$(MAKE ) $(build ) =$@ need-builtin=1 need-modorder=1
1666+
16681667clean : $(clean-dirs )
16691668 $(call cmd,rmdirs)
16701669 $(call cmd,rmfiles)
0 commit comments