ifeq ($(KBUILD_EXTMOD),)
# Objects we will link into vmlinux / subdirs we need to visit
-core-y := init/ usr/ arch/$(SRCARCH)/
-drivers-y := drivers/ sound/
-drivers-$(CONFIG_SAMPLES) += samples/
-drivers-$(CONFIG_NET) += net/
-drivers-y += virt/
+core-y :=
+drivers-y :=
libs-y := lib/
endif # KBUILD_EXTMOD
export MODULES_NSDEPS := $(extmod_prefix)modules.nsdeps
ifeq ($(KBUILD_EXTMOD),)
-core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/
-core-$(CONFIG_BLOCK) += block/
-core-$(CONFIG_IO_URING) += io_uring/
-vmlinux-dirs := $(patsubst %/,%,$(filter %/, \
- $(core-y) $(core-m) $(drivers-y) $(drivers-m) \
- $(libs-y) $(libs-m)))
-
-build-dirs := $(vmlinux-dirs)
-clean-dirs := $(sort $(vmlinux-dirs) Documentation . \
+build-dir := .
+clean-dirs := $(sort . Documentation \
$(patsubst %/,%,$(filter %/, $(core-) \
$(drivers-) $(libs-))))
-subdir-modorder := $(addsuffix /modules.order, $(build-dirs))
-
+export ARCH_CORE := $(core-y)
+export ARCH_LIB := $(filter %/, $(libs-y))
+export ARCH_DRIVERS := $(drivers-y) $(drivers-m)
# Externally visible symbols (used by link-vmlinux.sh)
-KBUILD_VMLINUX_OBJS := $(head-y) $(patsubst %/,%/built-in.a, $(core-y))
-KBUILD_VMLINUX_OBJS += $(addsuffix built-in.a, $(filter %/, $(libs-y)))
+
+KBUILD_VMLINUX_OBJS := $(head-y) ./built-in.a
ifdef CONFIG_MODULES
KBUILD_VMLINUX_OBJS += $(patsubst %/, %/lib.a, $(filter %/, $(libs-y)))
KBUILD_VMLINUX_LIBS := $(filter-out %/, $(libs-y))
else
KBUILD_VMLINUX_LIBS := $(patsubst %/,%/lib.a, $(libs-y))
endif
-KBUILD_VMLINUX_OBJS += $(patsubst %/,%/built-in.a, $(drivers-y))
export KBUILD_VMLINUX_OBJS KBUILD_VMLINUX_LIBS
export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds
# (this can be evaluated only once include/config/auto.conf has been included)
KBUILD_MODULES := 1
-autoksyms_recursive: descend modules.order
+autoksyms_recursive: $(build-dir) modules.order
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
"$(MAKE) -f $(srctree)/Makefile autoksyms_recursive"
endif
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
-$(sort $(vmlinux-deps) $(subdir-modorder)): descend ;
+$(sort $(vmlinux-deps)): . ;
filechk_kernel.release = \
echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))"
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_prepare
-cmd_modules_order = cat $(real-prereqs) > $@
-
-modules.order: $(subdir-modorder) FORCE
- $(call if_changed,modules_order)
-
-targets += modules.order
-
# Target to prepare building external modules
modules_prepare: prepare
$(Q)$(MAKE) $(build)=scripts scripts/module.lds
KBUILD_BUILTIN :=
KBUILD_MODULES := 1
-build-dirs := $(KBUILD_EXTMOD)
-$(MODORDER): descend
- @:
+build-dir := $(KBUILD_EXTMOD)
compile_commands.json: $(extmod_prefix)compile_commands.json
PHONY += compile_commands.json
ifdef CONFIG_MODULES
+$(MODORDER): $(build-dir)
+ @:
+
modules: modules_check
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
$(single-ko): single_modpost
@:
-$(single-no-ko): descend
+$(single-no-ko): $(build-dir)
@:
# Remove MODORDER when done because it is not the real one.
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
$(Q)rm -f $(MODORDER)
-single-goals := $(addprefix $(extmod_prefix), $(single-no-ko))
-
-# trim unrelated directories
-build-dirs := $(foreach d, $(build-dirs), \
- $(if $(filter $d/%, $(single-goals)), $d))
+single-goals := $(addprefix $(build-dir)/, $(single-no-ko))
endif
-# Handle descending into subdirectories listed in $(build-dirs)
# Preset locale variables to speed up the build process. Limit locale
# tweaks to this spot to avoid wrong language settings when running
# make menuconfig etc.
# Error messages still appears in the original language
-PHONY += descend $(build-dirs)
-descend: $(build-dirs)
-$(build-dirs): prepare
- $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 \
- $(filter $@/%, $(single-goals))
+PHONY += $(build-dir)
+$(build-dir): prepare
+ $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 $(single-goals)
clean-dirs := $(addprefix _clean_, $(clean-dirs))
PHONY += $(clean-dirs) clean