include scripts/Kbuild.include
kernelsymfile := $(objtree)/Module.symvers
-modulesymfile := $(KBUILD_EXTMOD)/Module.symvers
MODPOST = scripts/mod/modpost \
$(if $(CONFIG_MODVERSIONS),-m) \
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
- $(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
+ $(if $(KBUILD_EXTMOD),-i $(kernelsymfile)) \
$(if $(KBUILD_EXTMOD),$(addprefix -i ,$(KBUILD_EXTRA_SYMBOLS))) \
- $(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
- $(if $(KBUILD_MODPOST_WARN),-w)
+ $(if $(KBUILD_MODPOST_WARN),-w) \
+ -o $@
ifdef MODPOST_VMLINUX
-quiet_cmd_modpost = MODPOST vmlinux.o
- cmd_modpost = $(MODPOST) vmlinux.o
+quiet_cmd_modpost = MODPOST $@
+ cmd_modpost = $(MODPOST) $<
-__modpost:
+Module.symvers: vmlinux.o
$(call cmd,modpost)
+__modpost: Module.symvers
+
else
MODPOST += -s \
ifeq ($(KBUILD_EXTMOD),)
MODPOST += $(wildcard vmlinux)
+output-symdump := Module.symvers
+
else
# set src + obj - they may be used in the modules's Makefile
# modpost option for external modules
MODPOST += -e
+output-symdump := $(KBUILD_EXTMOD)/Module.symvers
+
endif
# modpost options for modules (both in-kernel and external)
MODPOST += -n
endif
-# find all modules listed in modules.order
-modules := $(sort $(shell cat $(MODORDER)))
-
-# Read out modules.order instead of expanding $(modules) to pass in modpost.
+# Read out modules.order to pass in modpost.
# Otherwise, allmodconfig would fail with "Argument list too long".
-quiet_cmd_modpost = MODPOST $(words $(modules)) modules
+quiet_cmd_modpost = MODPOST $@
cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST) -T -
-__modpost:
+$(output-symdump): FORCE
$(call cmd,modpost)
+
+__modpost: $(output-symdump)
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
endif
+PHONY += FORCE
+FORCE:
+
endif
.PHONY: $(PHONY)