summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2016-04-22 15:25:00 -0400
committerMichal Marek <mmarek@suse.com>2016-04-26 04:39:19 -0400
commit2441e78b19192cd9ea1ce93027a5732a2117f026 (patch)
tree64d942caf22837e283f6be06e63e71aabe7ea4bc /Makefile
parentba79d401f1aee52186ff09607e9405cfb805307d (diff)
kbuild: better abstract vmlinux sequential prerequisites
When CONFIG_TRIM_UNUSED_KSYMS=y and CONFIG_BUILD_DOCSRC=y it is possible to get the following error: ERROR: "cn_del_callback" [Documentation/connector/cn_test.ko] undefined! ERROR: "cn_add_callback" [Documentation/connector/cn_test.ko] undefined! ERROR: "cn_netlink_send" [Documentation/connector/cn_test.ko] undefined! ../scripts/Makefile.modpost:91: recipe for target '__modpost' failed It is not sufficient to do "vmlinux-dirs += Documentation" as this also depends on the headers_check target, and all of this needs to be done before adjust_autoksyms.sh is executed. Let's sort this out by gathering those sequential prerequisites in a make target of their own, separate from the vmlinux target. And by doing so, the special autoksyms_recursive target is no longer needed. Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 15 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index e9ad498238e7..3f1eb6a1bf8d 100644
--- a/Makefile
+++ b/Makefile
@@ -926,17 +926,11 @@ export KBUILD_ALLDIRS := $(sort $(filter-out arch/%,$(vmlinux-alldirs)) arch Doc
926 926
927vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) 927vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN)
928 928
929# Final link of vmlinux 929# Include targets which we want to execute sequentially if the rest of the
930 cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) 930# kernel build went well. If CONFIG_TRIM_UNUSED_KSYMS is set, this might be
931quiet_cmd_link-vmlinux = LINK $@ 931# evaluated more than once.
932 932PHONY += vmlinux_prereq
933# Include targets which we want to 933vmlinux_prereq: $(vmlinux-deps) FORCE
934# execute if the rest of the kernel build went well.
935vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE
936ifdef CONFIG_TRIM_UNUSED_KSYMS
937 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
938 "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile autoksyms_recursive"
939endif
940ifdef CONFIG_HEADERS_CHECK 934ifdef CONFIG_HEADERS_CHECK
941 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 935 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
942endif 936endif
@@ -946,17 +940,22 @@ endif
946ifdef CONFIG_GDB_SCRIPTS 940ifdef CONFIG_GDB_SCRIPTS
947 $(Q)ln -fsn `cd $(srctree) && /bin/pwd`/scripts/gdb/vmlinux-gdb.py 941 $(Q)ln -fsn `cd $(srctree) && /bin/pwd`/scripts/gdb/vmlinux-gdb.py
948endif 942endif
949 +$(call if_changed,link-vmlinux) 943ifdef CONFIG_TRIM_UNUSED_KSYMS
950
951autoksyms_recursive: $(vmlinux-deps)
952 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ 944 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \
953 "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile autoksyms_recursive" 945 "$(MAKE) KBUILD_MODULES=1 -f $(srctree)/Makefile vmlinux_prereq"
954PHONY += autoksyms_recursive 946endif
955 947
956# standalone target for easier testing 948# standalone target for easier testing
957include/generated/autoksyms.h: FORCE 949include/generated/autoksyms.h: FORCE
958 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true 950 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh true
959 951
952# Final link of vmlinux
953 cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux)
954quiet_cmd_link-vmlinux = LINK $@
955
956vmlinux: scripts/link-vmlinux.sh vmlinux_prereq FORCE
957 +$(call if_changed,link-vmlinux)
958
960# Build samples along the rest of the kernel 959# Build samples along the rest of the kernel
961ifdef CONFIG_SAMPLES 960ifdef CONFIG_SAMPLES
962vmlinux-dirs += samples 961vmlinux-dirs += samples