summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile32
1 files changed, 25 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 21c41a03d98d..41ab27601bb4 100644
--- a/Makefile
+++ b/Makefile
@@ -1150,7 +1150,7 @@ cmd_link-vmlinux = \
$(CONFIG_SHELL) $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \
$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
-vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) FORCE
+vmlinux: scripts/link-vmlinux.sh vmlinux.o $(KBUILD_LDS) modpost FORCE
+$(call if_changed_dep,link-vmlinux)
targets := vmlinux
@@ -1426,7 +1426,13 @@ endif
# Build modules
#
-modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_prepare
+# *.ko are usually independent of vmlinux, but CONFIG_DEBUG_INFOBTF_MODULES
+# is an exception.
+ifdef CONFIG_DEBUG_INFO_BTF_MODULES
+modules: vmlinux
+endif
+
+modules: modules_prepare
# Target to prepare building external modules
modules_prepare: prepare
@@ -1739,8 +1745,12 @@ ifdef CONFIG_MODULES
$(MODORDER): $(build-dir)
@:
-modules: modules_check
- $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+# KBUILD_MODPOST_NOFINAL can be set to skip the final link of modules.
+# This is solely useful to speed up test compiles.
+modules: modpost
+ifneq ($(KBUILD_MODPOST_NOFINAL),1)
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
+endif
PHONY += modules_check
modules_check: $(MODORDER)
@@ -1771,6 +1781,11 @@ KBUILD_MODULES :=
endif # CONFIG_MODULES
+PHONY += modpost
+modpost: $(if $(single-build),, $(if $(KBUILD_BUILTIN), vmlinux.o)) \
+ $(if $(KBUILD_MODULES), modules_check)
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+
# Single targets
# ---------------------------------------------------------------------------
# To build individual files in subdirectories, you can do like this:
@@ -1790,16 +1805,19 @@ single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
single-no-ko := $(filter-out $(single-ko), $(MAKECMDGOALS)) \
$(foreach x, o mod, $(patsubst %.ko, %.$x, $(single-ko)))
-$(single-ko): single_modpost
+$(single-ko): single_modules
@:
$(single-no-ko): $(build-dir)
@:
# Remove MODORDER when done because it is not the real one.
-PHONY += single_modpost
-single_modpost: $(single-no-ko) modules_prepare
+PHONY += single_modules
+single_modules: $(single-no-ko) modules_prepare
$(Q){ $(foreach m, $(single-ko), echo $(extmod_prefix)$m;) } > $(MODORDER)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+ifneq ($(KBUILD_MODPOST_NOFINAL),1)
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
+endif
$(Q)rm -f $(MODORDER)
single-goals := $(addprefix $(build-dir)/, $(single-no-ko))