summaryrefslogtreecommitdiff
path: root/scripts/Makefile.modpost
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2020-06-01 14:57:12 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2020-06-06 23:38:12 +0900
commit436b2ac603d58504f38041a0cd8adb5aeace992b (patch)
tree2c150062375bf949ddfe8cd1623e9cfc143fb969 /scripts/Makefile.modpost
parent269a535ca931b754a40dda3ab60514e68773c759 (diff)
modpost: invoke modpost only when input files are updated
Currently, the second pass of modpost is always invoked when you run 'make' or 'make modules' even if none of modules is changed. Use if_changed to invoke it only when it is necessary. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/Makefile.modpost')
-rw-r--r--scripts/Makefile.modpost20
1 files changed, 16 insertions, 4 deletions
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 896c799911c5..f29a02196b72 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -90,7 +90,7 @@ endif
# modpost options for modules (both in-kernel and external)
MODPOST += \
- $(addprefix -i ,$(input-symdump)) \
+ $(addprefix -i ,$(wildcard $(input-symdump))) \
$(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N)
# 'make -i -k' ignores compile errors, and builds as many modules as possible.
@@ -98,13 +98,18 @@ ifneq ($(findstring i,$(filter-out --%,$(MAKEFLAGS))),)
MODPOST += -n
endif
+$(input-symdump):
+ @:
+
# Read out modules.order to pass in modpost.
# Otherwise, allmodconfig would fail with "Argument list too long".
quiet_cmd_modpost = MODPOST $@
- cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST) -T -
+ cmd_modpost = sed 's/ko$$/o/' $< | $(MODPOST) -T -
-$(output-symdump): FORCE
- $(call cmd,modpost)
+$(output-symdump): $(MODORDER) $(input-symdump) FORCE
+ $(call if_changed,modpost)
+
+targets += $(output-symdump)
__modpost: $(output-symdump)
ifneq ($(KBUILD_MODPOST_NOFINAL),1)
@@ -114,6 +119,13 @@ endif
PHONY += FORCE
FORCE:
+existing-targets := $(wildcard $(sort $(targets)))
+
+-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
+
+PHONY += FORCE
+FORCE:
+
endif
.PHONY: $(PHONY)